Signed-off-by: W. Michael Petullo <mike@flyn.org>lilik-openwrt-22.03
@ -0,0 +1,538 @@ | |||||
# | |||||
# Copyright (C) 2006-2014 OpenWrt.org | |||||
# | |||||
# This is free software, licensed under the GNU General Public License v2. | |||||
# See /LICENSE for more information. | |||||
# | |||||
include $(TOPDIR)/rules.mk | |||||
PKG_NAME:=php | |||||
PKG_VERSION:=5.4.33 | |||||
PKG_RELEASE:=1 | |||||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> | |||||
PKG_LICENSE=PHPv3.01 | |||||
PKG_LICENSE_FILE=LICENSE | |||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 | |||||
PKG_SOURCE_URL:=http://www.php.net/distributions/ | |||||
PKG_MD5SUM:=c6878bb1cdb46bfc1e1a5cd67a024737 | |||||
PKG_FIXUP:=libtool no-autoreconf | |||||
PKG_BUILD_PARALLEL:=1 | |||||
PHP5_MODULES = \ | |||||
calendar ctype curl \ | |||||
fileinfo \ | |||||
dom \ | |||||
exif \ | |||||
ftp \ | |||||
gettext gd gmp \ | |||||
hash \ | |||||
iconv \ | |||||
json \ | |||||
ldap \ | |||||
mbstring mcrypt mysql mysqli \ | |||||
openssl \ | |||||
pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \ | |||||
session shmop simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \ | |||||
tokenizer \ | |||||
xml xmlreader xmlwriter zip \ | |||||
PKG_CONFIG_DEPENDS:= \ | |||||
$(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \ | |||||
CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML CONFIG_PHP5_SYSTEMTZDATA | |||||
include $(INCLUDE_DIR)/package.mk | |||||
include $(INCLUDE_DIR)/nls.mk | |||||
define Package/php5/Default | |||||
SUBMENU:=PHP | |||||
SECTION:=lang | |||||
CATEGORY:=Languages | |||||
TITLE:=PHP5 Hypertext preprocessor | |||||
URL:=http://www.php.net/ | |||||
MAINTAINER:=Michael Heimpold <mhei@heimpold.de> | |||||
DEPENDS:=php5 | |||||
endef | |||||
define Package/php5/Default/description | |||||
PHP is a widely-used general-purpose scripting language that is especially | |||||
suited for Web development and can be embedded into HTML. | |||||
endef | |||||
define Package/php5/config | |||||
config PHP5_FILTER | |||||
bool "PHP5 Filter support" | |||||
depends on PACKAGE_php5-cli || PACKAGE_php5-cgi | |||||
config PHP5_LIBXML | |||||
bool "PHP5 LIBXML support" | |||||
depends on PACKAGE_php5-cli || PACKAGE_php5-cgi | |||||
config PHP5_SYSTEMTZDATA | |||||
bool "Use system timezone data instead of php's built-in database" | |||||
depends on PACKAGE_php5-cli || PACKAGE_php5-cgi | |||||
select PACKAGE_zoneinfo-core | |||||
default y | |||||
help | |||||
Enabling this feature automatically selects the zoneinfo-core package | |||||
which contains data for UTC timezone. To use other timezones you have | |||||
to install the corresponding zoneinfo-... package(s). | |||||
endef | |||||
define Package/php5 | |||||
$(call Package/php5/Default) | |||||
DEPENDS:=+libpcre +zlib \ | |||||
+PHP5_LIBXML:libxml2 | |||||
endef | |||||
define Package/php5/description | |||||
$(call Package/php5/Default/description) | |||||
This package contains only the PHP config file. You must actually choose | |||||
your PHP flavour (cli, cgi or fastcgi). | |||||
endef | |||||
define Package/php5-cli | |||||
$(call Package/php5/Default) | |||||
TITLE+= (CLI) | |||||
endef | |||||
define Package/php5-cli/description | |||||
$(call Package/php5/Default/description) | |||||
This package contains the CLI version of the PHP5 interpreter. | |||||
endef | |||||
define Package/php5-cgi | |||||
$(call Package/php5/Default) | |||||
TITLE+= (CGI & FastCGI) | |||||
endef | |||||
define Package/php5-cgi/description | |||||
$(call Package/php5/Default/description) | |||||
This package contains the CGI version of the PHP5 interpreter. | |||||
endef | |||||
define Package/php5-fastcgi | |||||
$(call Package/php5/Default) | |||||
DEPENDS+= +php5-cgi | |||||
TITLE:=FastCGI startup script | |||||
endef | |||||
define Package/php5-fastcgi/description | |||||
As FastCGI support is now a core feature the php5-fastcgi package now depends | |||||
on the php5-cgi package, containing just the startup script. | |||||
endef | |||||
CONFIGURE_ARGS+= \ | |||||
--enable-cli \ | |||||
--enable-cgi \ | |||||
--enable-shared \ | |||||
--disable-static \ | |||||
--disable-rpath \ | |||||
--disable-debug \ | |||||
--without-pear \ | |||||
\ | |||||
--with-config-file-path=/etc \ | |||||
--with-config-file-scan-dir=/etc/php5 \ | |||||
--disable-short-tags \ | |||||
\ | |||||
--with-zlib="$(STAGING_DIR)/usr" \ | |||||
--with-zlib-dir="$(STAGING_DIR)/usr" \ | |||||
--with-pcre-regex="$(STAGING_DIR)/usr" \ | |||||
--disable-phar | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-calendar),) | |||||
CONFIGURE_ARGS+= --enable-calendar=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-calendar | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ctype),) | |||||
CONFIGURE_ARGS+= --enable-ctype=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-ctype | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-curl),) | |||||
CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-curl | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-fileinfo),) | |||||
CONFIGURE_ARGS+= --enable-fileinfo=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-fileinfo | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gettext),) | |||||
CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full" | |||||
else | |||||
CONFIGURE_ARGS+= --without-gettext | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-dom),) | |||||
CONFIGURE_ARGS+= --enable-dom=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-dom | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-exif),) | |||||
CONFIGURE_ARGS+= --enable-exif=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-exif | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ftp),) | |||||
CONFIGURE_ARGS+= --enable-ftp=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-ftp | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gd),) | |||||
CONFIGURE_ARGS+= \ | |||||
--with-gd=shared \ | |||||
--without-freetype-dir \ | |||||
--with-jpeg-dir="$(STAGING_DIR)/usr" \ | |||||
--with-png-dir="$(STAGING_DIR)/usr" \ | |||||
--without-xpm-dir \ | |||||
--without-t1lib \ | |||||
--enable-gd-native-ttf \ | |||||
--disable-gd-jis-conv | |||||
else | |||||
CONFIGURE_ARGS+= --without-gd | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gmp),) | |||||
CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-gmp | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-hash),) | |||||
CONFIGURE_ARGS+= --enable-hash=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-hash | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-iconv),) | |||||
CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)" | |||||
else | |||||
CONFIGURE_ARGS+= --without-iconv | |||||
endif | |||||
ifneq ($(CONFIG_PACKAGE_php5-mod-json),) | |||||
CONFIGURE_ARGS+= --enable-json=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-json | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ldap),) | |||||
CONFIGURE_ARGS+= \ | |||||
--with-ldap=shared,"$(STAGING_DIR)/usr" \ | |||||
--with-ldap-sasl="$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-ldap | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mbstring),) | |||||
CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex | |||||
else | |||||
CONFIGURE_ARGS+= --disable-mbstring | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mcrypt),) | |||||
CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-mcrypt | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysql),) | |||||
CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-mysql | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysqli),) | |||||
CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config" | |||||
else | |||||
CONFIGURE_ARGS+= --without-mysqli | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),) | |||||
CONFIGURE_ARGS+= \ | |||||
--with-openssl=shared,"$(STAGING_DIR)/usr" \ | |||||
--with-kerberos=no \ | |||||
--with-openssl-dir="$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-openssl | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pcntl),) | |||||
CONFIGURE_ARGS+= --enable-pcntl=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-pcntl | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo),) | |||||
CONFIGURE_ARGS+= --enable-pdo=shared | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-mysql),) | |||||
CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-pdo-mysql | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-pgsql),) | |||||
CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-pdo-pgsql | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite),) | |||||
CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-pdo-sqlite | |||||
endif | |||||
else | |||||
CONFIGURE_ARGS+= --disable-pdo | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pgsql),) | |||||
CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-pgsql | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-session),) | |||||
CONFIGURE_ARGS+= --enable-session=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-session | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-shmop),) | |||||
CONFIGURE_ARGS+= --enable-shmop=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-shmop | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-simplexml),) | |||||
CONFIGURE_ARGS+= --enable-simplexml=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-simplexml | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-soap),) | |||||
CONFIGURE_ARGS+= --enable-soap=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-soap | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sockets),) | |||||
CONFIGURE_ARGS+= --enable-sockets=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-sockets | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite),) | |||||
CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-sqlite | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite3),) | |||||
CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --without-sqlite3 | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvmsg),) | |||||
CONFIGURE_ARGS+= --enable-sysvmsg=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-sysvmsg | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvsem),) | |||||
CONFIGURE_ARGS+= --enable-sysvsem=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-sysvsem | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvshm),) | |||||
CONFIGURE_ARGS+= --enable-sysvshm=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-sysvshm | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-tokenizer),) | |||||
CONFIGURE_ARGS+= --enable-tokenizer=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-tokenizer | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xml),) | |||||
CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr" | |||||
ifneq ($(CONFIG_PHP5_LIBXML),) | |||||
CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" | |||||
else | |||||
CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr" | |||||
endif | |||||
else | |||||
CONFIGURE_ARGS+= --disable-xml | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlreader),) | |||||
CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --disable-xmlreader | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlwriter),) | |||||
CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr" | |||||
else | |||||
CONFIGURE_ARGS+= --disable-xmlwriter | |||||
endif | |||||
ifneq ($(CONFIG_PACKAGE_php5-mod-zip),) | |||||
CONFIGURE_ARGS+= --enable-zip=shared | |||||
else | |||||
CONFIGURE_ARGS+= --disable-zip | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PHP5_FILTER),) | |||||
CONFIGURE_ARGS+= --enable-filter | |||||
else | |||||
CONFIGURE_ARGS+= --disable-filter | |||||
endif | |||||
ifneq ($(SDK)$(CONFIG_PHP5_LIBXML),) | |||||
CONFIGURE_ARGS+= --enable-libxml | |||||
CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" | |||||
else | |||||
CONFIGURE_ARGS+= --disable-libxml | |||||
endif | |||||
ifneq ($(CONFIG_PHP5_SYSTEMTZDATA),) | |||||
CONFIGURE_ARGS+= --with-system-tzdata | |||||
else | |||||
CONFIGURE_ARGS+= --without-system-tzdata | |||||
endif | |||||
CONFIGURE_VARS+= \ | |||||
ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \ | |||||
php_cv_cc_rpath="no" \ | |||||
iconv_impl_name="gnu_libiconv" \ | |||||
ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \ | |||||
define Package/php5/conffiles | |||||
/etc/php.ini | |||||
endef | |||||
define Package/php5/install | |||||
$(INSTALL_DIR) $(1)/etc | |||||
$(INSTALL_DATA) ./files/php.ini $(1)/etc/ | |||||
endef | |||||
define Package/php5-cli/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli | |||||
endef | |||||
define Package/php5-cgi/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi | |||||
ln -sf php-cgi $(1)/usr/bin/php-fcgi | |||||
endef | |||||
define Package/php5-fastcgi/install | |||||
$(INSTALL_DIR) $(1)/etc/config | |||||
$(INSTALL_DATA) ./files/php5-fastcgi.config $(1)/etc/config/php5-fastcgi | |||||
$(INSTALL_DIR) $(1)/etc/init.d | |||||
$(INSTALL_BIN) ./files/php5-fastcgi.init $(1)/etc/init.d/php5-fastcgi | |||||
endef | |||||
define Build/Prepare | |||||
$(call Build/Prepare/Default) | |||||
( cd $(PKG_BUILD_DIR); touch configure.in; ./buildconf --force ) | |||||
endef | |||||
define Build/InstallDev | |||||
mkdir -p $(PKG_BUILD_DIR)/staging/usr/bin | |||||
make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging | |||||
rm -f $(PKG_BUILD_DIR)/staging/usr/bin/php | |||||
$(CP) $(PKG_BUILD_DIR)/staging/* $(STAGING_DIR_HOST) | |||||
sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize | |||||
sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize | |||||
sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR_HOST)/usr\"#" $(STAGING_DIR_HOST)/usr/bin/php-config | |||||
endef | |||||
define BuildModule | |||||
define Package/php5-mod-$(1) | |||||
$(call Package/php5/Default) | |||||
ifneq ($(3),) | |||||
DEPENDS+=$(3) | |||||
endif | |||||
TITLE:=$(2) shared module | |||||
endef | |||||
define Package/php5-mod-$(1)/install | |||||
$(INSTALL_DIR) $$(1)/usr/lib/php | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/ | |||||
$(INSTALL_DIR) $$(1)/etc/php5 | |||||
echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini | |||||
endef | |||||
$$(eval $$(call BuildPackage,php5-mod-$(1))) | |||||
endef | |||||
$(eval $(call BuildPackage,php5)) | |||||
$(eval $(call BuildPackage,php5-cli)) | |||||
$(eval $(call BuildPackage,php5-cgi)) | |||||
$(eval $(call BuildPackage,php5-fastcgi)) | |||||
#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS])) | |||||
$(eval $(call BuildModule,calendar,Calendar)) | |||||
$(eval $(call BuildModule,ctype,Ctype)) | |||||
$(eval $(call BuildModule,curl,cURL,+PACKAGE_php5-mod-curl:libcurl)) | |||||
$(eval $(call BuildModule,fileinfo,Fileinfo,+PACKAGE_php5-mod-fileinfo:libmagic)) | |||||
$(eval $(call BuildModule,dom,DOM,+@PHP5_LIBXML +PACKAGE_php5-mod-dom:libxml2)) | |||||
$(eval $(call BuildModule,exif,EXIF)) | |||||
$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php5-mod-ftp:libopenssl)) | |||||
$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php5-mod-gettext:libintl-full)) | |||||
$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php5-mod-gd:libjpeg +PACKAGE_php5-mod-gd:libpng)) | |||||
$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php5-mod-gmp:libgmp)) | |||||
$(eval $(call BuildModule,hash,Hash)) | |||||
$(eval $(call BuildModule,iconv,iConv,+PACKAGE_php5-mod-iconv:libiconv)) | |||||
$(eval $(call BuildModule,json,JSON)) | |||||
$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php5-mod-ldap:libopenldap +PACKAGE_php5-mod-ldap:libsasl2)) | |||||
$(eval $(call BuildModule,mbstring,MBString)) | |||||
$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php5-mod-mcrypt:libmcrypt +PACKAGE_php5-mod-mcrypt:libltdl)) | |||||
$(eval $(call BuildModule,mysql,MySQL,+PACKAGE_php5-mod-mysql:libmysqlclient)) | |||||
$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php5-mod-mysqli:libmysqlclient)) | |||||
$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl)) | |||||
$(eval $(call BuildModule,pcntl,PCNTL)) | |||||
$(eval $(call BuildModule,pdo,PHP Data Objects)) | |||||
$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-mysql:libmysqlclient)) | |||||
$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-pgsql:libpq)) | |||||
$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php5-mod-pdo +PACKAGE_php5-mod-pdo-sqlite:libsqlite3 +PACKAGE_php5-mod-pdo-sqlite:libpthread +PACKAGE_php5-mod-pdo-sqlite:librt)) | |||||
$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php5-mod-pgsql:libpq)) | |||||
$(eval $(call BuildModule,session,Session)) | |||||
$(eval $(call BuildModule,shmop,Shared Memory)) | |||||
$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP5_LIBXML +PACKAGE_php5-mod-simplexml:libxml2)) | |||||
$(eval $(call BuildModule,soap,SOAP,+@PHP5_LIBXML +PACKAGE_php5-mod-soap:libxml2)) | |||||
$(eval $(call BuildModule,sockets,Sockets)) | |||||
$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php5-mod-sqlite3:libsqlite3 +PACKAGE_php5-mod-sqlite3:libpthread)) | |||||
$(eval $(call BuildModule,sysvmsg,System V messages)) | |||||
$(eval $(call BuildModule,sysvsem,System V shared memory)) | |||||
$(eval $(call BuildModule,sysvshm,System V semaphore)) | |||||
$(eval $(call BuildModule,tokenizer,Tokenizer)) | |||||
$(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat)) | |||||
$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlreader:libxml2 +PACKAGE_php5-mod-xmlreader:libiconv)) | |||||
$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlwriter:libxml2 +PACKAGE_php5-mod-xmlwriter:libiconv)) | |||||
$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php5-mod-zip:zlib)) |
@ -0,0 +1,311 @@ | |||||
[PHP] | |||||
zend.ze1_compatibility_mode = Off | |||||
; Language Options | |||||
engine = On | |||||
;short_open_tag = Off | |||||
precision = 12 | |||||
y2k_compliance = On | |||||
output_buffering = Off | |||||
;output_handler = | |||||
zlib.output_compression = Off | |||||
;zlib.output_compression_level = -1 | |||||
;zlib.output_handler = | |||||
implicit_flush = Off | |||||
unserialize_callback_func = | |||||
serialize_precision = 100 | |||||
;open_basedir = | |||||
disable_functions = | |||||
disable_classes = | |||||
; Colors for Syntax Highlighting mode. Anything that's acceptable in | |||||
; <span style="color: ???????"> would work. | |||||
;highlight.string = #DD0000 | |||||
;highlight.comment = #FF9900 | |||||
;highlight.keyword = #007700 | |||||
;highlight.bg = #FFFFFF | |||||
;highlight.default = #0000BB | |||||
;highlight.html = #000000 | |||||
;ignore_user_abort = On | |||||
;realpath_cache_size = 16k | |||||
;realpath_cache_ttl = 120 | |||||
; Miscellaneous | |||||
expose_php = On | |||||
; Resource Limits | |||||
max_execution_time = 30 ; Maximum execution time of each script, in seconds. | |||||
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data. | |||||
;max_input_nesting_level = 64 | |||||
memory_limit = 8M ; Maximum amount of memory a script may consume. | |||||
; Error handling and logging | |||||
; Error Level Constants: | |||||
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) | |||||
; E_ERROR - fatal run-time errors | |||||
; E_RECOVERABLE_ERROR - almost fatal run-time errors | |||||
; E_WARNING - run-time warnings (non-fatal errors) | |||||
; E_PARSE - compile-time parse errors | |||||
; E_NOTICE - run-time notices (these are warnings which often result | |||||
; from a bug in your code, but it's possible that it was | |||||
; intentional (e.g., using an uninitialized variable and | |||||
; relying on the fact it's automatically initialized to an | |||||
; empty string) | |||||
; E_STRICT - run-time notices, enable to have PHP suggest changes | |||||
; to your code which will ensure the best interoperability | |||||
; and forward compatibility of your code | |||||
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup | |||||
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's | |||||
; initial startup | |||||
; E_COMPILE_ERROR - fatal compile-time errors | |||||
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) | |||||
; E_USER_ERROR - user-generated error message | |||||
; E_USER_WARNING - user-generated warning message | |||||
; E_USER_NOTICE - user-generated notice message | |||||
; E_DEPRECATED - warn about code that will not work in future versions | |||||
; of PHP | |||||
; E_USER_DEPRECATED - user-generated deprecation warnings | |||||
; | |||||
; Common Values: | |||||
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) | |||||
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) | |||||
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) | |||||
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) | |||||
; Default Value: E_ALL & ~E_NOTICE | |||||
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT | |||||
display_errors = On | |||||
display_startup_errors = Off | |||||
log_errors = Off | |||||
log_errors_max_len = 1024 | |||||
ignore_repeated_errors = Off | |||||
ignore_repeated_source = Off | |||||
report_memleaks = On | |||||
;report_zend_debug = 0 | |||||
track_errors = Off | |||||
;html_errors = Off | |||||
;docref_root = "/phpmanual/" | |||||
;docref_ext = .html | |||||
;error_prepend_string = "<font color=#ff0000>" | |||||
;error_append_string = "</font>" | |||||
; Log errors to specified file. | |||||
;error_log = /var/log/php_errors.log | |||||
; Log errors to syslog. | |||||
;error_log = syslog | |||||
; Data Handling | |||||
;arg_separator.output = "&" | |||||
;arg_separator.input = ";&" | |||||
variables_order = "EGPCS" | |||||
request_order = "GP" | |||||
register_globals = Off | |||||
register_long_arrays = Off | |||||
register_argc_argv = On | |||||
auto_globals_jit = On | |||||
post_max_size = 8M | |||||
;magic_quotes_gpc = Off | |||||
magic_quotes_runtime = Off | |||||
magic_quotes_sybase = Off | |||||
auto_prepend_file = | |||||
auto_append_file = | |||||
default_mimetype = "text/html" | |||||
;default_charset = "iso-8859-1" | |||||
;always_populate_raw_post_data = On | |||||
; Paths and Directories | |||||
; UNIX: "/path1:/path2" | |||||
;include_path = ".:/php/includes" | |||||
doc_root = "/www" | |||||
user_dir = | |||||
extension_dir = "/usr/lib/php" | |||||
enable_dl = On | |||||
;cgi.force_redirect = 1 | |||||
;cgi.nph = 1 | |||||
;cgi.redirect_status_env = ; | |||||
cgi.fix_pathinfo=1 | |||||
;fastcgi.impersonate = 1; | |||||
;fastcgi.logging = 0 | |||||
;cgi.rfc2616_headers = 0 | |||||
; File Uploads | |||||
file_uploads = On | |||||
upload_tmp_dir = "/tmp" | |||||
upload_max_filesize = 2M | |||||
max_file_uploads = 20 | |||||
; Fopen wrappers | |||||
allow_url_fopen = On | |||||
allow_url_include = Off | |||||
;from="john@doe.com" | |||||
;user_agent="PHP" | |||||
default_socket_timeout = 60 | |||||
;auto_detect_line_endings = Off | |||||
; Dynamic Extensions | |||||
;extension=ctype.so | |||||
;extension=curl.so | |||||
;extension=dom.so | |||||
;extension=exif.so | |||||
;extension=ftp.so | |||||
;extension=gd.so | |||||
;extension=gmp.so | |||||
;extension=hash.so | |||||
;extension=iconv.so | |||||
;extension=json.so | |||||
;extension=ldap.so | |||||
;extension=mbstring.so | |||||
;extension=mcrypt.so | |||||
;extension=mysql.so | |||||
;extension=openssl.so | |||||
;extension=pcre.so | |||||
;extension=pdo.so | |||||
;extension=pdo-mysql.so | |||||
;extension=pdo-pgsql.so | |||||
;extension=pdo_sqlite.so | |||||
;extension=pgsql.so | |||||
;extension=session.so | |||||
;extension=soap.so | |||||
;extension=sockets.so | |||||
;extension=sqlite.so | |||||
;extension=sqlite3.so | |||||
;extension=tokenizer.so | |||||
;extension=xml.so | |||||
;extension=xmlreader.so | |||||
;extension=xmlwriter.so | |||||
; Module Settings | |||||
[APC] | |||||
apc.enabled = 1 | |||||
apc.shm_segments = 1 ;The number of shared memory segments to allocate for the compiler cache. | |||||
apc.shm_size = 4M ;The size of each shared memory segment. | |||||
[Date] | |||||
;date.timezone = | |||||
;date.default_latitude = 31.7667 | |||||
;date.default_longitude = 35.2333 | |||||
;date.sunrise_zenith = 90.583333 | |||||
;date.sunset_zenith = 90.583333 | |||||
[filter] | |||||
;filter.default = unsafe_raw | |||||
;filter.default_flags = | |||||
[iconv] | |||||
;iconv.input_encoding = ISO-8859-1 | |||||
;iconv.internal_encoding = ISO-8859-1 | |||||
;iconv.output_encoding = ISO-8859-1 | |||||
[sqlite] | |||||
;sqlite.assoc_case = 0 | |||||
[sqlite3] | |||||
;sqlite3.extension_dir = | |||||
[Pdo_mysql] | |||||
pdo_mysql.cache_size = 2000 | |||||
pdo_mysql.default_socket= | |||||
[MySQL] | |||||
mysql.allow_local_infile = On | |||||
mysql.allow_persistent = On | |||||
mysql.cache_size = 2000 | |||||
mysql.max_persistent = -1 | |||||
mysql.max_links = -1 | |||||
mysql.default_port = | |||||
mysql.default_socket = | |||||
mysql.default_host = | |||||
mysql.default_user = | |||||
mysql.default_password = | |||||
mysql.connect_timeout = 60 | |||||
mysql.trace_mode = Off | |||||
[PostgresSQL] | |||||
pgsql.allow_persistent = On | |||||
pgsql.auto_reset_persistent = Off | |||||
pgsql.max_persistent = -1 | |||||
pgsql.max_links = -1 | |||||
pgsql.ignore_notice = 0 | |||||
pgsql.log_notice = 0 | |||||
[Session] | |||||
session.save_handler = files | |||||
session.save_path = "/tmp" | |||||
session.use_cookies = 1 | |||||
;session.cookie_secure = | |||||
session.use_only_cookies = 1 | |||||
session.name = PHPSESSID | |||||
session.auto_start = 0 | |||||
session.cookie_lifetime = 0 | |||||
session.cookie_path = / | |||||
session.cookie_domain = | |||||
session.cookie_httponly = | |||||
session.serialize_handler = php | |||||
session.gc_probability = 1 | |||||
session.gc_divisor = 100 | |||||
session.gc_maxlifetime = 1440 | |||||
session.bug_compat_42 = On | |||||
session.bug_compat_warn = On | |||||
session.referer_check = | |||||
session.entropy_length = 0 | |||||
;session.entropy_file = /dev/urandom | |||||
session.entropy_file = | |||||
;session.entropy_length = 16 | |||||
session.cache_limiter = nocache | |||||
session.cache_expire = 180 | |||||
session.use_trans_sid = 0 | |||||
session.hash_function = 0 | |||||
session.hash_bits_per_character = 4 | |||||
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" | |||||
[mbstring] | |||||
;mbstring.language = Japanese | |||||
;mbstring.internal_encoding = EUC-JP | |||||
;mbstring.http_input = auto | |||||
;mbstring.http_output = SJIS | |||||
;mbstring.encoding_translation = Off | |||||
;mbstring.detect_order = auto | |||||
;mbstring.substitute_character = none; | |||||
;mbstring.func_overload = 0 | |||||
;mbstring.strict_detection = Off | |||||
;mbstring.http_output_conv_mimetype= | |||||
;mbstring.script_encoding= | |||||
[gd] | |||||
;gd.jpeg_ignore_warning = 0 | |||||
[exif] | |||||
;exif.encode_unicode = ISO-8859-15 | |||||
;exif.decode_unicode_motorola = UCS-2BE | |||||
;exif.decode_unicode_intel = UCS-2LE | |||||
;exif.encode_jis = | |||||
;exif.decode_jis_motorola = JIS | |||||
;exif.decode_jis_intel = JIS | |||||
[soap] | |||||
soap.wsdl_cache_enabled=1 | |||||
soap.wsdl_cache_dir="/tmp" | |||||
soap.wsdl_cache_ttl=86400 | |||||
soap.wsdl_cache_limit = 5 | |||||
[sysvshm] | |||||
;sysvshm.init_mem = 10000 | |||||
[ldap] | |||||
ldap.max_links = -1 | |||||
[mcrypt] | |||||
;mcrypt.algorithms_dir= | |||||
;mcrypt.modes_dir= |
@ -0,0 +1,3 @@ | |||||
config php5-fastcgi | |||||
option enabled 1 | |||||
option port '1026' |
@ -0,0 +1,30 @@ | |||||
#!/bin/sh /etc/rc.common | |||||
# Copyright (C) 2010-2011 OpenWrt.org | |||||
START=50 | |||||
SERVICE_DAEMONIZE=1 | |||||
SERVICE_WRITE_PID=1 | |||||
start_instance() { | |||||
local section="$1" | |||||
local enabled | |||||
local port | |||||
config_get_bool enabled "$section" 'enabled' 0 | |||||
config_get port "$section" 'port' 1026 | |||||
[ $enabled -gt 0 ] || return 1 | |||||
PHP_FCGI_CHILDREN='' \ | |||||
service_start /usr/bin/php-fcgi -b $port | |||||
} | |||||
start() { | |||||
config_load 'php5-fastcgi' | |||||
config_foreach start_instance 'php5-fastcgi' | |||||
} | |||||
stop() { | |||||
service_stop /usr/bin/php-fcgi | |||||
} |
@ -0,0 +1,101 @@ | |||||
--- a/ext/sqlite/pdo_sqlite2.c | |||||
+++ b/ext/sqlite/pdo_sqlite2.c | |||||
@@ -522,11 +522,6 @@ static char *make_filename_safe(const ch | |||||
return NULL; | |||||
} | |||||
- if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { | |||||
- efree(fullpath); | |||||
- return NULL; | |||||
- } | |||||
- | |||||
if (php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
efree(fullpath); | |||||
return NULL; | |||||
@@ -585,7 +580,7 @@ static int pdo_sqlite2_handle_factory(pd | |||||
if (!filename) { | |||||
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, | |||||
- "safe_mode/open_basedir prohibits opening %s", | |||||
+ "open_basedir prohibits opening %s", | |||||
dbh->data_source); | |||||
goto cleanup; | |||||
} | |||||
--- a/ext/sqlite/sqlite.c | |||||
+++ b/ext/sqlite/sqlite.c | |||||
@@ -1066,10 +1066,6 @@ static int php_sqlite_authorizer(void *a | |||||
case SQLITE_COPY: | |||||
if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) { | |||||
TSRMLS_FETCH(); | |||||
- if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { | |||||
- return SQLITE_DENY; | |||||
- } | |||||
- | |||||
if (php_check_open_basedir(arg4 TSRMLS_CC)) { | |||||
return SQLITE_DENY; | |||||
} | |||||
@@ -1079,10 +1075,6 @@ static int php_sqlite_authorizer(void *a | |||||
case SQLITE_ATTACH: | |||||
if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) { | |||||
TSRMLS_FETCH(); | |||||
- if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { | |||||
- return SQLITE_DENY; | |||||
- } | |||||
- | |||||
if (php_check_open_basedir(arg3 TSRMLS_CC)) { | |||||
return SQLITE_DENY; | |||||
} | |||||
@@ -1160,13 +1152,12 @@ static void sqlite_object_free_storage(v | |||||
static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers *handlers, zend_object_value *retval TSRMLS_DC) | |||||
{ | |||||
sqlite_object *intern; | |||||
- zval *tmp; | |||||
intern = emalloc(sizeof(sqlite_object)); | |||||
memset(intern, 0, sizeof(sqlite_object)); | |||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC); | |||||
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); | |||||
+ object_properties_init(&intern->std, class_type); | |||||
retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC); | |||||
retval->handlers = handlers; | |||||
@@ -1510,7 +1501,7 @@ static struct php_sqlite_db *php_sqlite_ | |||||
/* authorizer hook so we can enforce safe mode | |||||
* Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite, | |||||
* and IS backwards binary compatible with earlier versions */ | |||||
- if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) { | |||||
+ if (PG(open_basedir) && *PG(open_basedir)) { | |||||
sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL); | |||||
} | |||||
@@ -1569,8 +1560,7 @@ PHP_FUNCTION(sqlite_popen) | |||||
RETURN_FALSE; | |||||
} | |||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || | |||||
- php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
efree(fullpath); | |||||
RETURN_FALSE; | |||||
} | |||||
@@ -1656,8 +1646,7 @@ PHP_FUNCTION(sqlite_open) | |||||
} | |||||
} | |||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || | |||||
- php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
efree(fullpath); | |||||
zend_restore_error_handling(&error_handling TSRMLS_CC); | |||||
if (object) { | |||||
@@ -1710,8 +1699,7 @@ PHP_FUNCTION(sqlite_factory) | |||||
RETURN_NULL(); | |||||
} | |||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || | |||||
- php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) { | |||||
efree(fullpath); | |||||
zend_restore_error_handling(&error_handling TSRMLS_CC); | |||||
RETURN_NULL(); |
@ -0,0 +1,11 @@ | |||||
--- a/ext/standard/php_crypt_r.c | |||||
+++ b/ext/standard/php_crypt_r.c | |||||
@@ -96,6 +96,8 @@ void _crypt_extended_init_r(void) | |||||
InterlockedIncrement(&initialized); | |||||
#elif defined(HAVE_SYNC_FETCH_AND_ADD) | |||||
__sync_fetch_and_add(&initialized, 1); | |||||
+#elif (defined(__GNUC__) && (__GNUC__ == 3)) | |||||
+ initialized = 1; | |||||
#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ | |||||
membar_producer(); | |||||
atomic_add_int(&initialized, 1); |
@ -0,0 +1,620 @@ | |||||
Add support for use of the system timezone database, rather | |||||
than embedding a copy. Discussed upstream but was not desired. | |||||
History: | |||||
r9: fix another compile error without --with-system-tzdata configured | |||||
r8: fix compile error without --with-system-tzdata configured | |||||
r7: improve check for valid timezone id to exclude directories | |||||
r6: fix fd leak in r5, fix country code/BC flag use in | |||||
timezone_identifiers_list() using system db, | |||||
fix use of PECL timezonedb to override system db, | |||||
r5: reverts addition of "System/Localtime" fake tzname. | |||||
updated for 5.3.0, parses zone.tab to pick up mapping between | |||||
timezone name, country code and long/lat coords | |||||
r4: added "System/Localtime" tzname which uses /etc/localtime | |||||
r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) | |||||
r2: add filesystem trawl to set up name alias index | |||||
r1: initial revision | |||||
--- a/ext/date/lib/parse_tz.c | |||||
+++ b/ext/date/lib/parse_tz.c | |||||
@@ -20,6 +20,16 @@ | |||||
#include "timelib.h" | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+#include <sys/mman.h> | |||||
+#include <sys/stat.h> | |||||
+#include <limits.h> | |||||
+#include <fcntl.h> | |||||
+#include <unistd.h> | |||||
+ | |||||
+#include "php_scandir.h" | |||||
+#endif | |||||
+ | |||||
#include <stdio.h> | |||||
#ifdef HAVE_LOCALE_H | |||||
@@ -31,7 +41,12 @@ | |||||
#else | |||||
#include <strings.h> | |||||
#endif | |||||
+ | |||||
+#ifndef HAVE_SYSTEM_TZDATA | |||||
#include "timezonedb.h" | |||||
+#endif | |||||
+ | |||||
+#include <ctype.h> | |||||
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) | |||||
# if defined(__LITTLE_ENDIAN__) | |||||
@@ -51,9 +66,14 @@ | |||||
static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) | |||||
{ | |||||
- /* skip ID */ | |||||
- *tzf += 4; | |||||
- | |||||
+ if (memcmp(tzf, "TZif", 4) == 0) { | |||||
+ *tzf += 20; | |||||
+ return; | |||||
+ } | |||||
+ | |||||
+ /* skip ID */ | |||||
+ *tzf += 4; | |||||
+ | |||||
/* read BC flag */ | |||||
tz->bc = (**tzf == '\1'); | |||||
*tzf += 1; | |||||
@@ -256,7 +276,397 @@ void timelib_dump_tzinfo(timelib_tzinfo | |||||
} | |||||
} | |||||
-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ | |||||
+#ifdef HAVE_SYSTEM_TZDATA_PREFIX | |||||
+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX | |||||
+#else | |||||
+#define ZONEINFO_PREFIX "/usr/share/zoneinfo" | |||||
+#endif | |||||
+ | |||||
+/* System timezone database pointer. */ | |||||
+static const timelib_tzdb *timezonedb_system = NULL; | |||||
+ | |||||
+/* Hash table entry for the cache of the zone.tab mapping table. */ | |||||
+struct location_info { | |||||
+ char code[2]; | |||||
+ double latitude, longitude; | |||||
+ char name[64]; | |||||
+ char *comment; | |||||
+ struct location_info *next; | |||||
+}; | |||||
+ | |||||
+/* Cache of zone.tab. */ | |||||
+static struct location_info **system_location_table; | |||||
+ | |||||
+/* Size of the zone.tab hash table; a random-ish prime big enough to | |||||
+ * prevent too many collisions. */ | |||||
+#define LOCINFO_HASH_SIZE (1021) | |||||
+ | |||||
+static uint32_t tz_hash(const char *str) | |||||
+{ | |||||
+ const unsigned char *p = (const unsigned char *)str; | |||||
+ uint32_t hash = 5381; | |||||
+ int c; | |||||
+ | |||||
+ while ((c = *p++) != '\0') { | |||||
+ hash = (hash << 5) ^ hash ^ c; | |||||
+ } | |||||
+ | |||||
+ return hash % LOCINFO_HASH_SIZE; | |||||
+} | |||||
+ | |||||
+/* Parse an ISO-6709 date as used in zone.tab. Returns end of the | |||||
+ * parsed string on success, or NULL on parse error. On success, | |||||
+ * writes the parsed number to *result. */ | |||||
+static char *parse_iso6709(char *p, double *result) | |||||
+{ | |||||
+ double v, sign; | |||||
+ char *pend; | |||||
+ size_t len; | |||||
+ | |||||
+ if (*p == '+') | |||||
+ sign = 1.0; | |||||
+ else if (*p == '-') | |||||
+ sign = -1.0; | |||||
+ else | |||||
+ return NULL; | |||||
+ | |||||
+ p++; | |||||
+ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) | |||||
+ ;; | |||||
+ | |||||
+ /* Annoying encoding used by zone.tab has no decimal point, so use | |||||
+ * the length to determine the format: | |||||
+ * | |||||
+ * 4 = DDMM | |||||
+ * 5 = DDDMM | |||||
+ * 6 = DDMMSS | |||||
+ * 7 = DDDMMSS | |||||
+ */ | |||||
+ len = pend - p; | |||||
+ if (len < 4 || len > 7) { | |||||
+ return NULL; | |||||
+ } | |||||
+ | |||||
+ /* p => [D]DD */ | |||||
+ v = (p[0] - '0') * 10.0 + (p[1] - '0'); | |||||
+ p += 2; | |||||
+ if (len == 5 || len == 7) | |||||
+ v = v * 10.0 + (*p++ - '0'); | |||||
+ /* p => MM[SS] */ | |||||
+ v += (10.0 * (p[0] - '0') | |||||
+ + p[1] - '0') / 60.0; | |||||
+ p += 2; | |||||
+ /* p => [SS] */ | |||||
+ if (len > 5) { | |||||
+ v += (10.0 * (p[0] - '0') | |||||
+ + p[1] - '0') / 3600.0; | |||||
+ p += 2; | |||||
+ } | |||||
+ | |||||
+ /* Round to five decimal place, not because it's a good idea, | |||||
+ * but, because the builtin data uses rounded data, so, match | |||||
+ * that. */ | |||||
+ *result = round(v * sign * 100000.0) / 100000.0; | |||||
+ | |||||
+ return p; | |||||
+} | |||||
+ | |||||
+/* This function parses the zone.tab file to build up the mapping of | |||||
+ * timezone to country code and geographic location, and returns a | |||||
+ * hash table. The hash table is indexed by the function: | |||||
+ * | |||||
+ * tz_hash(timezone-name) | |||||
+ */ | |||||
+static struct location_info **create_location_table(void) | |||||
+{ | |||||
+ struct location_info **li, *i; | |||||
+ char zone_tab[PATH_MAX]; | |||||
+ char line[512]; | |||||
+ FILE *fp; | |||||
+ | |||||
+ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); | |||||
+ | |||||
+ fp = fopen(zone_tab, "r"); | |||||
+ if (!fp) { | |||||
+ return NULL; | |||||
+ } | |||||
+ | |||||
+ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); | |||||
+ | |||||
+ while (fgets(line, sizeof line, fp)) { | |||||
+ char *p = line, *code, *name, *comment; | |||||
+ uint32_t hash; | |||||
+ double latitude, longitude; | |||||
+ | |||||
+ while (isspace(*p)) | |||||
+ p++; | |||||
+ | |||||
+ if (*p == '#' || *p == '\0' || *p == '\n') | |||||
+ continue; | |||||
+ | |||||
+ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') | |||||
+ continue; | |||||
+ | |||||
+ /* code => AA */ | |||||
+ code = p; | |||||
+ p[2] = 0; | |||||
+ p += 3; | |||||
+ | |||||
+ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ | |||||
+ p = parse_iso6709(p, &latitude); | |||||
+ if (!p) { | |||||
+ continue; | |||||
+ } | |||||
+ p = parse_iso6709(p, &longitude); | |||||
+ if (!p) { | |||||
+ continue; | |||||
+ } | |||||
+ | |||||
+ if (!p || *p != '\t') { | |||||
+ continue; | |||||
+ } | |||||
+ | |||||
+ /* name = string */ | |||||
+ name = ++p; | |||||
+ while (*p != '\t' && *p && *p != '\n') | |||||
+ p++; | |||||
+ | |||||
+ *p++ = '\0'; | |||||
+ | |||||
+ /* comment = string */ | |||||
+ comment = p; | |||||
+ while (*p != '\t' && *p && *p != '\n') | |||||
+ p++; | |||||
+ | |||||
+ if (*p == '\n' || *p == '\t') | |||||
+ *p = '\0'; | |||||
+ | |||||
+ hash = tz_hash(name); | |||||
+ i = malloc(sizeof *i); | |||||
+ memcpy(i->code, code, 2); | |||||
+ strncpy(i->name, name, sizeof i->name); | |||||
+ i->comment = strdup(comment); | |||||
+ i->longitude = longitude; | |||||
+ i->latitude = latitude; | |||||
+ i->next = li[hash]; | |||||
+ li[hash] = i; | |||||
+ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ | |||||
+ } | |||||
+ | |||||
+ fclose(fp); | |||||
+ | |||||
+ return li; | |||||
+} | |||||
+ | |||||
+/* Return location info from hash table, using given timezone name. | |||||
+ * Returns NULL if the name could not be found. */ | |||||
+const struct location_info *find_zone_info(struct location_info **li, | |||||
+ const char *name) | |||||
+{ | |||||
+ uint32_t hash = tz_hash(name); | |||||
+ const struct location_info *l; | |||||
+ | |||||
+ if (!li) { | |||||
+ return NULL; | |||||
+ } | |||||
+ | |||||
+ for (l = li[hash]; l; l = l->next) { | |||||
+ if (strcasecmp(l->name, name) == 0) | |||||
+ return l; | |||||
+ } | |||||
+ | |||||
+ return NULL; | |||||
+} | |||||
+ | |||||
+/* Filter out some non-tzdata files and the posix/right databases, if | |||||
+ * present. */ | |||||
+static int index_filter(const struct dirent *ent) | |||||
+{ | |||||
+ return strcmp(ent->d_name, ".") != 0 | |||||
+ && strcmp(ent->d_name, "..") != 0 | |||||
+ && strcmp(ent->d_name, "posix") != 0 | |||||
+ && strcmp(ent->d_name, "posixrules") != 0 | |||||
+ && strcmp(ent->d_name, "right") != 0 | |||||
+ && strstr(ent->d_name, ".tab") == NULL; | |||||
+} | |||||
+ | |||||
+static int sysdbcmp(const void *first, const void *second) | |||||
+{ | |||||
+ const timelib_tzdb_index_entry *alpha = first, *beta = second; | |||||
+ | |||||
+ return strcmp(alpha->id, beta->id); | |||||
+} | |||||
+ | |||||
+ | |||||
+/* Create the zone identifier index by trawling the filesystem. */ | |||||
+static void create_zone_index(timelib_tzdb *db) | |||||
+{ | |||||
+ size_t dirstack_size, dirstack_top; | |||||
+ size_t index_size, index_next; | |||||
+ timelib_tzdb_index_entry *db_index; | |||||
+ char **dirstack; | |||||
+ | |||||
+ /* LIFO stack to hold directory entries to scan; each slot is a | |||||
+ * directory name relative to the zoneinfo prefix. */ | |||||
+ dirstack_size = 32; | |||||
+ dirstack = malloc(dirstack_size * sizeof *dirstack); | |||||
+ dirstack_top = 1; | |||||
+ dirstack[0] = strdup(""); | |||||
+ | |||||
+ /* Index array. */ | |||||
+ index_size = 64; | |||||
+ db_index = malloc(index_size * sizeof *db_index); | |||||
+ index_next = 0; | |||||
+ | |||||
+ do { | |||||
+ struct dirent **ents; | |||||
+ char name[PATH_MAX], *top; | |||||
+ int count; | |||||
+ | |||||
+ /* Pop the top stack entry, and iterate through its contents. */ | |||||
+ top = dirstack[--dirstack_top]; | |||||
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); | |||||
+ | |||||
+ count = php_scandir(name, &ents, index_filter, php_alphasort); | |||||
+ | |||||
+ while (count > 0) { | |||||
+ struct stat st; | |||||
+ const char *leaf = ents[count - 1]->d_name; | |||||
+ | |||||
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", | |||||
+ top, leaf); | |||||
+ | |||||
+ if (strlen(name) && stat(name, &st) == 0) { | |||||
+ /* Name, relative to the zoneinfo prefix. */ | |||||
+ const char *root = top; | |||||
+ | |||||
+ if (root[0] == '/') root++; | |||||
+ | |||||
+ snprintf(name, sizeof name, "%s%s%s", root, | |||||
+ *root ? "/": "", leaf); | |||||
+ | |||||
+ if (S_ISDIR(st.st_mode)) { | |||||
+ if (dirstack_top == dirstack_size) { | |||||
+ dirstack_size *= 2; | |||||
+ dirstack = realloc(dirstack, | |||||
+ dirstack_size * sizeof *dirstack); | |||||
+ } | |||||
+ dirstack[dirstack_top++] = strdup(name); | |||||
+ } | |||||
+ else { | |||||
+ if (index_next == index_size) { | |||||
+ index_size *= 2; | |||||
+ db_index = realloc(db_index, | |||||
+ index_size * sizeof *db_index); | |||||
+ } | |||||
+ | |||||
+ db_index[index_next++].id = strdup(name); | |||||
+ } | |||||
+ } | |||||
+ | |||||
+ free(ents[--count]); | |||||
+ } | |||||
+ | |||||
+ if (count != -1) free(ents); | |||||
+ free(top); | |||||
+ } while (dirstack_top); | |||||
+ | |||||
+ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); | |||||
+ | |||||
+ db->index = db_index; | |||||
+ db->index_size = index_next; | |||||
+ | |||||
+ free(dirstack); | |||||
+} | |||||
+ | |||||
+#define FAKE_HEADER "1234\0??\1??" | |||||
+#define FAKE_UTC_POS (7 - 4) | |||||
+ | |||||
+/* Create a fake data segment for database 'sysdb'. */ | |||||
+static void fake_data_segment(timelib_tzdb *sysdb, | |||||
+ struct location_info **info) | |||||
+{ | |||||
+ size_t n; | |||||
+ char *data, *p; | |||||
+ | |||||
+ data = malloc(3 * sysdb->index_size + 7); | |||||
+ | |||||
+ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); | |||||
+ | |||||
+ for (n = 0; n < sysdb->index_size; n++) { | |||||
+ const struct location_info *li; | |||||
+ timelib_tzdb_index_entry *ent; | |||||
+ | |||||
+ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; | |||||
+ | |||||
+ /* Lookup the timezone name in the hash table. */ | |||||
+ if (strcmp(ent->id, "UTC") == 0) { | |||||
+ ent->pos = FAKE_UTC_POS; | |||||
+ continue; | |||||
+ } | |||||
+ | |||||
+ li = find_zone_info(info, ent->id); | |||||
+ if (li) { | |||||
+ /* If found, append the BC byte and the | |||||
+ * country code; set the position for this | |||||
+ * section of timezone data. */ | |||||
+ ent->pos = (p - data) - 4; | |||||
+ *p++ = '\1'; | |||||
+ *p++ = li->code[0]; | |||||
+ *p++ = li->code[1]; | |||||
+ } | |||||
+ else { | |||||
+ /* If not found, the timezone data can | |||||
+ * point at the header. */ | |||||
+ ent->pos = 0; | |||||
+ } | |||||
+ } | |||||
+ | |||||
+ sysdb->data = (unsigned char *)data; | |||||
+} | |||||
+ | |||||
+/* Returns true if the passed-in stat structure describes a | |||||
+ * probably-valid timezone file. */ | |||||
+static int is_valid_tzfile(const struct stat *st) | |||||
+{ | |||||
+ return S_ISREG(st->st_mode) && st->st_size > 20; | |||||
+} | |||||
+ | |||||
+/* Return the mmap()ed tzfile if found, else NULL. On success, the | |||||
+ * length of the mapped data is placed in *length. */ | |||||
+static char *map_tzfile(const char *timezone, size_t *length) | |||||
+{ | |||||
+ char fname[PATH_MAX]; | |||||
+ struct stat st; | |||||
+ char *p; | |||||
+ int fd; | |||||
+ | |||||
+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { | |||||
+ return NULL; | |||||
+ } | |||||
+ | |||||
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); | |||||
+ | |||||
+ fd = open(fname, O_RDONLY); | |||||
+ if (fd == -1) { | |||||
+ return NULL; | |||||
+ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { | |||||
+ close(fd); | |||||
+ return NULL; | |||||
+ } | |||||
+ | |||||
+ *length = st.st_size; | |||||
+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); | |||||
+ close(fd); | |||||
+ | |||||
+ return p != MAP_FAILED ? p : NULL; | |||||
+} | |||||
+ | |||||
+#endif | |||||
+ | |||||
+static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) | |||||
{ | |||||
int left = 0, right = tzdb->index_size - 1; | |||||
#ifdef HAVE_SETLOCALE | |||||
@@ -295,36 +705,128 @@ static int seek_to_tz_position(const uns | |||||
return 0; | |||||
} | |||||
+static int seek_to_tz_position(const unsigned char **tzf, char *timezone, | |||||
+ char **map, size_t *maplen, | |||||
+ const timelib_tzdb *tzdb) | |||||
+{ | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ if (tzdb == timezonedb_system) { | |||||
+ char *orig; | |||||
+ | |||||
+ orig = map_tzfile(timezone, maplen); | |||||
+ if (orig == NULL) { | |||||
+ return 0; | |||||
+ } | |||||
+ | |||||
+ (*tzf) = (unsigned char *)orig ; | |||||
+ *map = orig; | |||||
+ | |||||
+ return 1; | |||||
+ } | |||||
+ else | |||||
+#endif | |||||
+ { | |||||
+ return inmem_seek_to_tz_position(tzf, timezone, tzdb); | |||||
+ } | |||||
+} | |||||
+ | |||||
const timelib_tzdb *timelib_builtin_db(void) | |||||
{ | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ if (timezonedb_system == NULL) { | |||||
+ timelib_tzdb *tmp = malloc(sizeof *tmp); | |||||
+ | |||||
+ tmp->version = "0.system"; | |||||
+ tmp->data = NULL; | |||||
+ create_zone_index(tmp); | |||||
+ system_location_table = create_location_table(); | |||||
+ fake_data_segment(tmp, system_location_table); | |||||
+ timezonedb_system = tmp; | |||||
+ } | |||||
+ | |||||
+ | |||||
+ return timezonedb_system; | |||||
+#else | |||||
return &timezonedb_builtin; | |||||
+#endif | |||||
} | |||||
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) | |||||
{ | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ *count = timezonedb_system->index_size; | |||||
+ return timezonedb_system->index; | |||||
+#else | |||||
*count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); | |||||
return timezonedb_idx_builtin; | |||||
+#endif | |||||
} | |||||
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) | |||||
{ | |||||
const unsigned char *tzf; | |||||
- return (seek_to_tz_position(&tzf, timezone, tzdb)); | |||||
+ | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ if (tzdb == timezonedb_system) { | |||||
+ char fname[PATH_MAX]; | |||||
+ struct stat st; | |||||
+ | |||||
+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { | |||||
+ return 0; | |||||
+ } | |||||
+ | |||||
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); | |||||
+ | |||||
+ return stat(fname, &st) == 0 && is_valid_tzfile(&st); | |||||
+ } | |||||
+#endif | |||||
+ | |||||
+ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); | |||||
} | |||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) | |||||
{ | |||||
const unsigned char *tzf; | |||||
+ char *memmap = NULL; | |||||
+ size_t maplen; | |||||
timelib_tzinfo *tmp; | |||||
- if (seek_to_tz_position(&tzf, timezone, tzdb)) { | |||||
+ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { | |||||
tmp = timelib_tzinfo_ctor(timezone); | |||||
read_preamble(&tzf, tmp); | |||||
read_header(&tzf, tmp); | |||||
read_transistions(&tzf, tmp); | |||||
read_types(&tzf, tmp); | |||||
- read_location(&tzf, tmp); | |||||
+ | |||||
+#ifdef HAVE_SYSTEM_TZDATA | |||||
+ if (memmap) { | |||||
+ const struct location_info *li; | |||||
+ | |||||
+ /* TZif-style - grok the location info from the system database, | |||||
+ * if possible. */ | |||||
+ | |||||
+ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { | |||||
+ tmp->location.comments = strdup(li->comment); | |||||
+ strncpy(tmp->location.country_code, li->code, 2); | |||||
+ tmp->location.longitude = li->longitude; | |||||
+ tmp->location.latitude = li->latitude; | |||||
+ tmp->bc = 1; | |||||
+ } | |||||
+ else { | |||||
+ strcpy(tmp->location.country_code, "??"); | |||||
+ tmp->bc = 0; | |||||
+ tmp->location.comments = strdup(""); | |||||
+ } | |||||
+ | |||||
+ /* Now done with the mmap segment - discard it. */ | |||||
+ munmap(memmap, maplen); | |||||
+ } else | |||||
+#endif | |||||
+ { | |||||
+ /* PHP-style - use the embedded info. */ | |||||
+ read_location(&tzf, tmp); | |||||
+ } | |||||
} else { | |||||
tmp = NULL; | |||||
} | |||||
--- a/ext/date/lib/timelib.m4 | |||||
+++ b/ext/date/lib/timelib.m4 | |||||
@@ -78,3 +78,17 @@ stdlib.h | |||||
dnl Check for strtoll, atoll | |||||
AC_CHECK_FUNCS(strtoll atoll strftime) | |||||
+ | |||||
+PHP_ARG_WITH(system-tzdata, for use of system timezone data, | |||||
+[ --with-system-tzdata[=DIR] to specify use of system timezone data], | |||||
+no, no) | |||||
+ | |||||
+if test "$PHP_SYSTEM_TZDATA" != "no"; then | |||||
+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) | |||||
+ | |||||
+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then | |||||
+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", | |||||
+ [Define for location of system timezone data]) | |||||
+ fi | |||||
+fi | |||||
+ |
@ -0,0 +1,19 @@ | |||||
Author: Sean Finney <seanius@debian.org> | |||||
Forwarded: no (upstream doesn't want it) | |||||
Description: Silence warnings about using the default system timezone info | |||||
In vanilla upstream php, this is considered an error (i.e. the user must | |||||
set the timezone explicitly), though with our use of the system timezonedb | |||||
patch, we actually feel quite comfortable using the default timezone info. | |||||
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571762 | |||||
--- a/ext/date/tests/date_default_timezone_set-1.phpt | |||||
+++ b/ext/date/tests/date_default_timezone_set-1.phpt | |||||
@@ -22,9 +22,6 @@ date.timezone= | |||||
echo date(DATE_ISO8601, $date4), "\n"; | |||||
?> | |||||
--EXPECTF-- | |||||
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3 | |||||
- | |||||
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4 | |||||
America/Indiana/Knox | |||||
2005-01-12T03:00:00-0500 | |||||
2005-07-12T03:00:00-0500 |
@ -0,0 +1,14 @@ | |||||
--- a/configure.in | |||||
+++ b/configure.in | |||||
@@ -453,7 +453,10 @@ PHP_CHECK_FUNC(gethostname, nsl) | |||||
PHP_CHECK_FUNC(gethostbyaddr, nsl) | |||||
PHP_CHECK_FUNC(yp_get_default_domain, nsl) | |||||
-PHP_CHECK_FUNC(dlopen, dl) | |||||
+PHP_ADD_LIBRARY(dl) | |||||
+PHP_DEF_HAVE(dlopen) | |||||
+PHP_DEF_HAVE(libdl) | |||||
+ac_cv_func_dlopen=yes | |||||
if test "$ac_cv_func_dlopen" = "yes"; then | |||||
AC_DEFINE(HAVE_LIBDL, 1, [ ]) | |||||
fi |
@ -0,0 +1,47 @@ | |||||
# | |||||
# Copyright (C) 2011-2014 OpenWrt.org | |||||
# | |||||
# This is free software, licensed under the GNU General Public License v2. | |||||
# See /LICENSE for more information. | |||||
# | |||||
define Package/php5-pecl/Default | |||||
SUBMENU:=PHP | |||||
SECTION:=lang | |||||
CATEGORY:=Languages | |||||
URL:=http://pecl.php.net/ | |||||
MAINTAINER:=Michael Heimpold <mhei@heimpold.de> | |||||
DEPENDS:=php5 | |||||
endef | |||||
define Build/Configure | |||||
( cd $(PKG_BUILD_DIR); $(STAGING_DIR_HOST)/usr/bin/phpize ) | |||||
$(Build/Configure/Default) | |||||
endef | |||||
CONFIGURE_ARGS+= \ | |||||
--with-php-config=$(STAGING_DIR_HOST)/usr/bin/php-config | |||||
define PECLPackage | |||||
define Package/php5-pecl-$(1) | |||||
$(call Package/php5-pecl/Default) | |||||
TITLE:=$(2) | |||||
ifneq ($(3),) | |||||
DEPENDS+=$(3) | |||||
endif | |||||
endef | |||||
define Package/php5-pecl-$(1)/install | |||||
$(INSTALL_DIR) $$(1)/usr/lib/php | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/ | |||||
$(INSTALL_DIR) $$(1)/etc/php5 | |||||
ifeq ($(4),zend) | |||||
echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini | |||||
else | |||||
echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini | |||||
endif | |||||
endef | |||||
endef |