diff --git a/lang/php7/Makefile b/lang/php7/Makefile new file mode 100644 index 000000000..f8adb3be4 --- /dev/null +++ b/lang/php7/Makefile @@ -0,0 +1,587 @@ +# +# 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:=7.0.10 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.php.net/distributions/ +PKG_MD5SUM:=6f087f16514b6c442e8009a5828827b7 + +PKG_FIXUP:=libtool autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +PHP7_MODULES = \ + calendar ctype curl \ + fileinfo \ + dom \ + exif \ + ftp \ + gettext gd gmp \ + hash \ + iconv intl \ + json \ + ldap \ + mbstring mcrypt mysqli \ + opcache openssl \ + pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \ + session shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm \ + tokenizer \ + xml xmlreader xmlwriter zip \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_php7-mod-%,$(PHP7_MODULES)) \ + CONFIG_PHP7_FILTER CONFIG_PHP7_LIBXML CONFIG_PHP7_SYSTEMTZDATA + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/php7/Default + SUBMENU:=PHP + SECTION:=lang + CATEGORY:=Languages + TITLE:=PHP7 Hypertext preprocessor + URL:=http://www.php.net/ + DEPENDS:=php7 +endef + +define Package/php7/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/php7/config + config PHP7_FILTER + bool "PHP7 Filter support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_LIBXML + bool "PHP7 LIBXML support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_SYSTEMTZDATA + bool "Use system timezone data instead of php's built-in database" + depends on PACKAGE_php7-cli || PACKAGE_php7-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/php7 + $(call Package/php7/Default) + + DEPENDS:=+libpcre +zlib \ + +PHP7_LIBXML:libxml2 +endef + +define Package/php7/description + $(call Package/php7/Default/description) + This package contains only the PHP config file. You must actually choose + your PHP flavour (cli, cgi or fastcgi). + + Please note, that installing php5 and php7 in parallel on the same target + is not supported in OpenWrt/LEDE. +endef + +define Package/php7-cli + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CLI) +endef + +define Package/php7-cli/description + $(call Package/php7/Default/description) + This package contains the CLI version of the PHP7 interpreter. +endef + +define Package/php7-cgi + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CGI & FastCGI) +endef + +define Package/php7-cgi/description + $(call Package/php7/Default/description) + This package contains the CGI version of the PHP7 interpreter. +endef + +define Package/php7-fastcgi + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE:=FastCGI startup script +endef + +define Package/php7-fastcgi/description + As FastCGI support is now a core feature the php7-fastcgi package now depends + on the php7-cgi package, containing just the startup script. +endef + +define Package/php7-fpm + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE+= (FPM) +endef + +define Package/php7-fpm/description + $(call Package/php7/Default/description) + This package contains the FastCGI Process Manager of the PHP7 interpreter. +endef + +CONFIGURE_ARGS+= \ + --enable-cli \ + --enable-cgi \ + --enable-fpm \ + --enable-shared \ + --disable-static \ + --disable-rpath \ + --disable-debug \ + --disable-phpdbg \ + --without-pear \ + \ + --with-config-file-path=/etc \ + --with-config-file-scan-dir=/etc/php7 \ + --disable-short-tags \ + \ + --with-zlib="$(STAGING_DIR)/usr" \ + --with-zlib-dir="$(STAGING_DIR)/usr" \ + --disable-phar + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-calendar),) + CONFIGURE_ARGS+= --enable-calendar=shared +else + CONFIGURE_ARGS+= --disable-calendar +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ctype),) + CONFIGURE_ARGS+= --enable-ctype=shared +else + CONFIGURE_ARGS+= --disable-ctype +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-curl),) + CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-curl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-fileinfo),) + CONFIGURE_ARGS+= --enable-fileinfo=shared +else + CONFIGURE_ARGS+= --disable-fileinfo +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gettext),) + CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full" +else + CONFIGURE_ARGS+= --without-gettext +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-dom),) + CONFIGURE_ARGS+= --enable-dom=shared +else + CONFIGURE_ARGS+= --disable-dom +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-exif),) + CONFIGURE_ARGS+= --enable-exif=shared +else + CONFIGURE_ARGS+= --disable-exif +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ftp),) + CONFIGURE_ARGS+= --enable-ftp=shared +else + CONFIGURE_ARGS+= --disable-ftp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-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_php7-mod-gmp),) + CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-gmp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-hash),) + CONFIGURE_ARGS+= --enable-hash=shared +else + CONFIGURE_ARGS+= --disable-hash +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-iconv),) + CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)" +else + CONFIGURE_ARGS+= --without-iconv +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-intl),) + CONFIGURE_ARGS+= --enable-intl=shared +else + CONFIGURE_ARGS+= --disable-intl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-json),) + CONFIGURE_ARGS+= --enable-json=shared +else + CONFIGURE_ARGS+= --disable-json +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-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_php7-mod-mbstring),) + CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex +else + CONFIGURE_ARGS+= --disable-mbstring +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mcrypt),) + CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-mcrypt +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mysqli),) + CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config" +else + CONFIGURE_ARGS+= --without-mysqli +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-opcache),) + CONFIGURE_ARGS+= --enable-opcache=shared +else + CONFIGURE_ARGS+= --disable-opcache +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-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_php7-mod-pcntl),) + CONFIGURE_ARGS+= --enable-pcntl=shared +else + CONFIGURE_ARGS+= --disable-pcntl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo),) + CONFIGURE_ARGS+= --enable-pdo=shared + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-mysql),) + CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-mysql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-pgsql),) + CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-pgsql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-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_php7-mod-pgsql),) + CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-pgsql +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-session),) + CONFIGURE_ARGS+= --enable-session=shared +else + CONFIGURE_ARGS+= --disable-session +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-shmop),) + CONFIGURE_ARGS+= --enable-shmop=shared +else + CONFIGURE_ARGS+= --disable-shmop +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-simplexml),) + CONFIGURE_ARGS+= --enable-simplexml=shared +else + CONFIGURE_ARGS+= --disable-simplexml +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-soap),) + CONFIGURE_ARGS+= --enable-soap=shared +else + CONFIGURE_ARGS+= --disable-soap +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sockets),) + CONFIGURE_ARGS+= --enable-sockets=shared +else + CONFIGURE_ARGS+= --disable-sockets +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sqlite3),) + CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-sqlite3 +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvmsg),) + CONFIGURE_ARGS+= --enable-sysvmsg=shared +else + CONFIGURE_ARGS+= --disable-sysvmsg +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvsem),) + CONFIGURE_ARGS+= --enable-sysvsem=shared +else + CONFIGURE_ARGS+= --disable-sysvsem +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvshm),) + CONFIGURE_ARGS+= --enable-sysvshm=shared +else + CONFIGURE_ARGS+= --disable-sysvshm +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-tokenizer),) + CONFIGURE_ARGS+= --enable-tokenizer=shared +else + CONFIGURE_ARGS+= --disable-tokenizer +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xml),) + CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr" + ifneq ($(CONFIG_PHP7_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_php7-mod-xmlreader),) + CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlreader +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlwriter),) + CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlwriter +endif + +ifneq ($(CONFIG_PACKAGE_php7-mod-zip),) + CONFIGURE_ARGS+= --enable-zip=shared +else + CONFIGURE_ARGS+= --disable-zip +endif + +ifneq ($(SDK)$(CONFIG_PHP7_FILTER),) + CONFIGURE_ARGS+= --enable-filter +else + CONFIGURE_ARGS+= --disable-filter +endif + +ifneq ($(SDK)$(CONFIG_PHP7_LIBXML),) + CONFIGURE_ARGS+= --enable-libxml + CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" +else + CONFIGURE_ARGS+= --disable-libxml +endif + +#ifneq ($(CONFIG_PHP7_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/php7/conffiles +/etc/php.ini +endef + +define Package/php7/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php.ini $(1)/etc/ +endef + +define Package/php7-cli/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli +endef + +define Package/php7-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/php7-fastcgi/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fastcgi.config $(1)/etc/config/php7-fastcgi + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fastcgi.init $(1)/etc/init.d/php7-fastcgi +endef + +define Package/php7-fpm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sapi/fpm/php-fpm $(1)/usr/bin/php-fpm + + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php7-fpm.conf $(1)/etc/php7-fpm.conf + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fpm.config $(1)/etc/config/php7-fpm + + $(INSTALL_DIR) $(1)/etc/php7-fpm.d + $(INSTALL_DATA) ./files/php7-fpm-www.conf $(1)/etc/php7-fpm.d/www.conf + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fpm.init $(1)/etc/init.d/php7-fpm +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 -rf $(PKG_BUILD_DIR)/staging/usr/{share,man,sbin} + rm -f $(PKG_BUILD_DIR)/staging/usr/bin/{php,php-cgi,php-cli} + mv $(PKG_BUILD_DIR)/staging/usr/bin/phpize $(PKG_BUILD_DIR)/staging/usr/bin/phpize7 + mv $(PKG_BUILD_DIR)/staging/usr/bin/php-config $(PKG_BUILD_DIR)/staging/usr/bin/php7-config + mv $(PKG_BUILD_DIR)/staging/usr/include/php $(PKG_BUILD_DIR)/staging/usr/include/php7 + mv $(PKG_BUILD_DIR)/staging/usr/lib/php $(PKG_BUILD_DIR)/staging/usr/lib/php7 + + $(CP) $(PKG_BUILD_DIR)/staging/usr $(STAGING_DIR)/ + + sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/include\`/php\"#/include\`/php7\"#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/lib/php\`/build\"#/lib/php7\`/build\"#" $(STAGING_DIR)/usr/bin/phpize7 + + sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR)/usr\"#" $(STAGING_DIR)/usr/bin/php7-config + sed -i -e "s#/include/php\"#/include/php7\"#" $(STAGING_DIR)/usr/bin/php7-config +endef + +define BuildModule + + define Package/php7-mod-$(1) + $(call Package/php7/Default) + + ifneq ($(3),) + DEPENDS+=$(3) + endif + + TITLE:=$(2) shared module + endef + + define Package/php7-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/php7 + ifeq ($(4),zend) + echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(subst -,_,$(1)).ini + else + echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(subst -,_,$(1)).ini + endif + endef + + $$(eval $$(call BuildPackage,php7-mod-$(1))) + +endef + +$(eval $(call BuildPackage,php7)) +$(eval $(call BuildPackage,php7-cgi)) +$(eval $(call BuildPackage,php7-cli)) +$(eval $(call BuildPackage,php7-fastcgi)) +$(eval $(call BuildPackage,php7-fpm)) + +#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS])) +$(eval $(call BuildModule,calendar,Calendar)) +$(eval $(call BuildModule,ctype,Ctype)) +$(eval $(call BuildModule,curl,cURL,+PACKAGE_php7-mod-curl:libcurl)) +$(eval $(call BuildModule,dom,DOM,+@PHP7_LIBXML +PACKAGE_php7-mod-dom:libxml2)) +$(eval $(call BuildModule,exif,EXIF)) +$(eval $(call BuildModule,fileinfo,Fileinfo)) +$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php7-mod-ftp:libopenssl)) +$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php7-mod-gd:libjpeg +PACKAGE_php7-mod-gd:libpng)) +$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php7-mod-gettext:libintl-full)) +$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php7-mod-gmp:libgmp)) +$(eval $(call BuildModule,hash,Hash)) +$(eval $(call BuildModule,iconv,iConv,$(ICONV_DEPENDS))) +$(eval $(call BuildModule,intl,Internationalization Functions,+PACKAGE_php7-mod-intl:icu)) +$(eval $(call BuildModule,json,JSON)) +$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php7-mod-ldap:libopenldap +PACKAGE_php7-mod-ldap:libsasl2)) +$(eval $(call BuildModule,mbstring,MBString)) +$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php7-mod-mcrypt:libmcrypt +PACKAGE_php7-mod-mcrypt:libltdl)) +$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php7-mod-mysqli:libmysqlclient)) +$(eval $(call BuildModule,opcache,OPcache,,zend)) +$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php7-mod-openssl:libopenssl)) +$(eval $(call BuildModule,pcntl,PCNTL)) +$(eval $(call BuildModule,pdo,PHP Data Objects)) +$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-mysql:libmysqlclient)) +$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-pgsql:libpq)) +$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php7-mod-pdo +PACKAGE_php7-mod-pdo-sqlite:libsqlite3 +PACKAGE_php7-mod-pdo-sqlite:librt)) +$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php7-mod-pgsql:libpq)) +$(eval $(call BuildModule,session,Session)) +$(eval $(call BuildModule,shmop,Shared Memory)) +$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP7_LIBXML +PACKAGE_php7-mod-simplexml:libxml2)) +$(eval $(call BuildModule,soap,SOAP,+@PHP7_LIBXML +PACKAGE_php7-mod-soap:libxml2)) +$(eval $(call BuildModule,sockets,Sockets)) +$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php7-mod-sqlite3:libsqlite3)) +$(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,+PHP7_LIBXML:libxml2 +!PHP7_LIBXML:libexpat)) +$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlreader:libxml2)) +$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlwriter:libxml2)) +$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php7-mod-zip:zlib)) diff --git a/lang/php7/files/php.ini b/lang/php7/files/php.ini new file mode 100644 index 000000000..23a8bb988 --- /dev/null +++ b/lang/php7/files/php.ini @@ -0,0 +1,321 @@ +[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 +; 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 = "" +;error_append_string = "" +; 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= + +[opcache] +;opcache.memory_consumption=8 ; 8M is the allowed minimum +;opcache.interned_strings_buffer=1 +opcache.max_accelerated_files=200 ; 200 is the allowed minimum +;opcache.revalidate_freq=60 +;opcache.fast_shutdown=1 +opcache.enable_cli=1 +opcache.enable=1 +;opcache.log_verbosity_level=4 diff --git a/lang/php7/files/php7-fastcgi.config b/lang/php7/files/php7-fastcgi.config new file mode 100644 index 000000000..22e9998c0 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.config @@ -0,0 +1,3 @@ +config php7-fastcgi + option enabled 1 + option port '1026' diff --git a/lang/php7/files/php7-fastcgi.init b/lang/php7/files/php7-fastcgi.init new file mode 100644 index 000000000..21f5b09e1 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.init @@ -0,0 +1,29 @@ +#!/bin/sh /etc/rc.common + +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 'php7-fastcgi' + config_foreach start_instance 'php7-fastcgi' +} + +stop() { + service_stop /usr/bin/php-fcgi +} diff --git a/lang/php7/files/php7-fpm-www.conf b/lang/php7/files/php7-fpm-www.conf new file mode 100644 index 000000000..d3a32224f --- /dev/null +++ b/lang/php7/files/php7-fpm-www.conf @@ -0,0 +1,392 @@ +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = nobody +;group = + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php7-fpm.sock + +; Set listen(2) backlog. +; Default Value: 128 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 128 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0666 +;listen.owner = www-data +;listen.group = www-data +;listen.mode = 0666 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = / + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/lang/php7/files/php7-fpm.conf b/lang/php7/files/php7-fpm.conf new file mode 100644 index 000000000..c980b2190 --- /dev/null +++ b/lang/php7/files/php7-fpm.conf @@ -0,0 +1,121 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr). This prefix can be dynamically changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p argument) +; - /usr otherwise +;include=/etc/php7/fpm/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /var +; Default Value: none +pid = /var/run/php7-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /var +; Default Value: log/php-fpm.log +error_log = /var/log/php7-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +; process.max = 128 + +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +; events.mechanism = epoll + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; To configure the pools it is recommended to have one .conf file per +; pool in the following directory: +include=/etc/php7-fpm.d/*.conf diff --git a/lang/php7/files/php7-fpm.config b/lang/php7/files/php7-fpm.config new file mode 100644 index 000000000..3a893c6f2 --- /dev/null +++ b/lang/php7/files/php7-fpm.config @@ -0,0 +1,2 @@ +config php7-fpm + option enabled 1 diff --git a/lang/php7/files/php7-fpm.init b/lang/php7/files/php7-fpm.init new file mode 100644 index 000000000..c913a2b6f --- /dev/null +++ b/lang/php7/files/php7-fpm.init @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +START=50 + +PROG=/usr/bin/php-fpm +CONFIG=/etc/php7-fpm.conf + +SERVICE_PID_FILE=/var/run/php7-fpm.pid + +start_instance() { + local section="$1" + local enabled + + config_get_bool enabled "$section" 'enabled' 0 + + [ $enabled -gt 0 ] || return 1 + + service_start $PROG -y $CONFIG -g $SERVICE_PID_FILE +} + +start() { + config_load 'php7-fpm' + config_foreach start_instance 'php7-fpm' +} + +stop() { + service_stop $PROG +} diff --git a/lang/php7/patches/101-fix_membar_producer_link_error_gcc3x.patch b/lang/php7/patches/101-fix_membar_producer_link_error_gcc3x.patch new file mode 100644 index 000000000..3e81dd6b9 --- /dev/null +++ b/lang/php7/patches/101-fix_membar_producer_link_error_gcc3x.patch @@ -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); diff --git a/lang/php7/patches/200-ext-opcache-fix-detection-of-shm-mmap.patch b/lang/php7/patches/200-ext-opcache-fix-detection-of-shm-mmap.patch new file mode 100644 index 000000000..d2a1e91af --- /dev/null +++ b/lang/php7/patches/200-ext-opcache-fix-detection-of-shm-mmap.patch @@ -0,0 +1,159 @@ +From dc8bb6a53bfdfe42d9ae81d4e78c6155ad4bfd6e Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Sun, 17 May 2015 16:50:50 +0200 +Subject: [PATCH] ext/opcache: fix detection of shm/mmap + +The detection of sysvipc and mmap doesn't work well when cross-compiling, +so I decided to only check for the availability of the functions involved. +This is not a clean solution, but works for now(tm) :-) + +It should be discussed with upstream to find a better solution. + +This solves the issue reported at +https://github.com/openwrt/packages/issues/1010 +and makes opcache usable on OpenWrt. + +Signed-off-by: Michael Heimpold +--- + ext/opcache/config.m4 | 122 ++----------------------------------------------- + 1 file changed, 4 insertions(+), 118 deletions(-) + +diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 +index b7e4835..7b6c0aa 100644 +--- a/ext/opcache/config.m4 ++++ b/ext/opcache/config.m4 +@@ -11,127 +11,13 @@ if test "$PHP_OPCACHE" != "no"; then + AC_DEFINE(HAVE_MPROTECT, 1, [Define if you have mprotect() function]) + ]) + +- AC_MSG_CHECKING(for sysvipc shared memory support) +- AC_TRY_RUN([ +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { +- pid_t pid; +- int status; +- int ipc_id; +- char *shm; +- struct shmid_ds shmbuf; +- +- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W)); +- if (ipc_id == -1) { +- return 1; +- } +- +- shm = shmat(ipc_id, NULL, 0); +- if (shm == (void *)-1) { +- shmctl(ipc_id, IPC_RMID, NULL); +- return 2; +- } +- +- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) { +- shmdt(shm); +- shmctl(ipc_id, IPC_RMID, NULL); +- return 3; +- } +- +- shmbuf.shm_perm.uid = getuid(); +- shmbuf.shm_perm.gid = getgid(); +- shmbuf.shm_perm.mode = 0600; +- +- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) { +- shmdt(shm); +- shmctl(ipc_id, IPC_RMID, NULL); +- return 4; +- } +- +- shmctl(ipc_id, IPC_RMID, NULL); +- +- strcpy(shm, "hello"); +- +- pid = fork(); +- if (pid < 0) { +- return 5; +- } else if (pid == 0) { +- strcpy(shm, "bye"); +- return 6; +- } +- if (wait(&status) != pid) { +- return 7; +- } +- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { +- return 8; +- } +- if (strcmp(shm, "bye") != 0) { +- return 9; +- } +- return 0; +-} +-],dnl ++ AC_CHECK_FUNC(shmget,[ + AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) +- msg=yes,msg=no,msg=no) +- AC_MSG_RESULT([$msg]) +- +- AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) +- AC_TRY_RUN([ +-#include +-#include +-#include +-#include +-#include +- +-#ifndef MAP_ANON +-# ifdef MAP_ANONYMOUS +-# define MAP_ANON MAP_ANONYMOUS +-# endif +-#endif +-#ifndef MAP_FAILED +-# define MAP_FAILED ((void*)-1) +-#endif +- +-int main() { +- pid_t pid; +- int status; +- char *shm; +- +- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); +- if (shm == MAP_FAILED) { +- return 1; +- } +- +- strcpy(shm, "hello"); ++ ]) + +- pid = fork(); +- if (pid < 0) { +- return 5; +- } else if (pid == 0) { +- strcpy(shm, "bye"); +- return 6; +- } +- if (wait(&status) != pid) { +- return 7; +- } +- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { +- return 8; +- } +- if (strcmp(shm, "bye") != 0) { +- return 9; +- } +- return 0; +-} +-],dnl ++ AC_CHECK_FUNC(mmap,[ + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) +- msg=yes,msg=no,msg=no) +- AC_MSG_RESULT([$msg]) ++ ]) + + AC_MSG_CHECKING(for mmap() using /dev/zero shared memory support) + AC_TRY_RUN([ +-- +1.7.10.4 + diff --git a/lang/php7/patches/800-gd-iconv.patch b/lang/php7/patches/800-gd-iconv.patch new file mode 100644 index 000000000..1418c276f --- /dev/null +++ b/lang/php7/patches/800-gd-iconv.patch @@ -0,0 +1,14 @@ +--- a/ext/gd/libgd/gdkanji.c ++++ b/ext/gd/libgd/gdkanji.c +@@ -9,6 +9,11 @@ + #include "gdhelpers.h" + + #include ++ ++/* force usage of internal conversation routine */ ++#undef HAVE_ICONV_H ++#undef HAVE_ICONV ++ + #if defined(HAVE_ICONV_H) || defined(HAVE_ICONV) + #include + #ifdef HAVE_ERRNO_H diff --git a/lang/php7/patches/950-Fix-dl-cross-compiling-issue.patch b/lang/php7/patches/950-Fix-dl-cross-compiling-issue.patch new file mode 100644 index 000000000..22122ec82 --- /dev/null +++ b/lang/php7/patches/950-Fix-dl-cross-compiling-issue.patch @@ -0,0 +1,59 @@ +--- 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 +--- a/ext/fileinfo/config.m4 ++++ b/ext/fileinfo/config.m4 +@@ -46,6 +46,10 @@ int main(void) + AC_MSG_RESULT(no) + AC_MSG_NOTICE(using libmagic strcasestr implementation) + libmagic_sources="$libmagic_sources libmagic/strcasestr.c" ++ ],[ ++ dnl cross-compiling; assume not present ++ AC_MSG_NOTICE(using libmagic strcasestr implementation) ++ libmagic_sources="$libmagic_sources libmagic/strcasestr.c" + ]) + + PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic) +--- a/ext/opcache/config.m4 ++++ b/ext/opcache/config.m4 +@@ -227,7 +227,14 @@ AC_TRY_RUN([ + flock_type=linux + AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ flock_type=linux ++ AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) ++ AC_MSG_RESULT("yes") ++]) + + AC_MSG_CHECKING("whether flock struct is BSD ordered") + AC_TRY_RUN([ +@@ -243,7 +250,12 @@ AC_TRY_RUN([ + flock_type=bsd + AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ AC_MSG_RESULT("no") ++]) + + if test "$flock_type" == "unknown"; then + AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) diff --git a/lang/php7/pecl.mk b/lang/php7/pecl.mk new file mode 100644 index 000000000..79715560e --- /dev/null +++ b/lang/php7/pecl.mk @@ -0,0 +1,44 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/php7-pecl/Default + SUBMENU:=PHP + SECTION:=lang + CATEGORY:=Languages + URL:=http://pecl.php.net/ + DEPENDS:=php7 +endef + +define Build/Prepare + $(Build/Prepare/Default) + ( cd $(PKG_BUILD_DIR); $(STAGING_DIR)/usr/bin/phpize7 ) +endef + +CONFIGURE_ARGS+= \ + --with-php-config=$(STAGING_DIR)/usr/bin/php7-config + +define PECLPackage + + define Package/php7-pecl-$(1) + $(call Package/php7-pecl/Default) + TITLE:=$(2) + + ifneq ($(3),) + DEPENDS+=$(3) + endif + endef + + define Package/php7-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/php7 + ifeq ($(4),zend) + echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(subst -,_,$(1)).ini + else + echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(subst -,_,$(1)).ini + endif + endef + +endef