php: add apache support
PATCH v5 1/1 php: add apache support
Continue work started by Bernd Kuhls in
https://patchwork.ozlabs.org/patch/437544/
---
Changes v4 -> v5 (after review of Arnout Vandecappelle):
- Patch on pthread detection has been merged upstream and is available in php 7.0.14 so https://patchwork.ozlabs.org/patch/670567/
has been set as "Not Applicable"
- Remove hook added in v4 and let php updates the apache configuration file
- Patch apxs configuration file to update httpd.conf in the target directory with the correct relative path. Without these hooks, apxs will only update correctly the httpd.conf in the staging directory
Changes v3 -> v4 (after review of Yann Morin):
- Do not select apache but depends on it
- Move pthread detection fix in a separate patch
- Remove unneeded configuration options such as --with-config-file-path
- Do not allow php to update apache configuration file by removing -a argument from apxs call
Changes v2 -> v3 (after review of Thomas Petazzoni):
- Remove unneeded php-04-apache.patch
- Fix pthread detection if Apache MPM is event or worker
- Update pthread detection mechanism (--enable-pthreads does not exist anymore)
- Remove unneeded --oldincludedir
- Fix php module path
package/php/Config.in | 8 ++++++++ package/php/php.mk | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
package/php/Config.in +8 -0
@@ -1,6 +1,7 @@ config BR2_PACKAGE_PHP bool "php" select BR2_PACKAGE_PHP_SAPI_CGI if \ + !BR2_PACKAGE_PHP_SAPI_APACHE && \ !BR2_PACKAGE_PHP_SAPI_CLI && \ !BR2_PACKAGE_PHP_SAPI_FPM && \ BR2_USE_MMU
@@ -14,6 +15,13 @@ config BR2_PACKAGE_PHP if BR2_PACKAGE_PHP +config BR2_PACKAGE_PHP_SAPI_APACHE + bool "Apache interface" + depends on BR2_PACKAGE_APACHE + select BR2_PACKAGE_PHP_HAS_SAPI + help + Apache module + config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI interface" # CGI uses fork()
package/php/php.mk +27 -0
@@ -81,6 +81,33 @@ PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli) PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),--enable-cgi,--disable-cgi) PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm) +ifeq ($(BR2_PACKAGE_PHP_SAPI_APACHE),y) +PHP_DEPENDENCIES += apache +PHP_CONF_OPTS += --with-apxs2=$(STAGING_DIR)/usr/bin/apxs + +# Enable thread safety option if Apache MPM is event or worker +ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT)$(BR2_PACKAGE_APACHE_MPM_WORKER),y) +PHP_CONF_OPTS += --enable-maintainer-zts +endif + +# apxs configuration must be patched to update the httpd.conf in the +# target directory with the correct relative path. Without these hooks, +# apxs will only update correctly the httpd.conf in the staging directory. +define PHP_SET_TARGET_PREFIX_APXS + $(SED) 's%^prefix =.*%prefix = $(TARGET_DIR)/usr%' \ + $(STAGING_DIR)/usr/build/config_vars.mk +endef + +PHP_PRE_INSTALL_TARGET_HOOKS += PHP_SET_TARGET_PREFIX_APXS + +define PHP_SET_STAGING_PREFIX_APXS + $(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' \ + $(STAGING_DIR)/usr/build/config_vars.mk +endef + +PHP_POST_INSTALL_TARGET_HOOKS += PHP_SET_STAGING_PREFIX_APXS +endif + ### Extensions PHP_CONF_OPTS += \ $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \
Signature · 1 line
2.5.0
PATCH v5 1/1 php: add apache support
Hello,
package/php/Config.in config BR2_PACKAGE_PHP · line 21
Quoted 6 lines · Fabrice Fontaine
if
BR2_PACKAGE_PHPpackage/php/Config.in +4
-0+config BR2_PACKAGE_PHP_SAPI_APACHE + bool "Apache interface" + depends on BR2_PACKAGE_APACHE + select BR2_PACKAGE_PHP_HAS_SAPI
This option no longer exists, so this select should be removed.
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli) · line 86
Quoted 3 lines
package/php/php.mk +3
-0+ifeq ($(BR2_PACKAGE_PHP_SAPI_APACHE),y) +PHP_DEPENDENCIES += apache +PHP_CONF_OPTS += --with-apxs2=$(STAGING_DIR)/usr/bin/apxs
This looks strange:
- If this file path is used during the build, then it's broken because /usr/bin/apxs in $(STAGING_DIR) is built for the target architecture (unless it's some kind of script, of course).
- If this file path is used at runtime, then it's broken because $(STAGING_DIR)/usr/bin/apxs doesn't exist once on the target.
In any case, a comment above this would be good to have to explain why it's correct (if it is).
Quoted 6 lines
package/php/php.mk +6
-0+# apxs configuration must be patched to update the httpd.conf in the +# target directory with the correct relative path. Without these hooks, +# apxs will only update correctly the httpd.conf in the staging directory. +define PHP_SET_TARGET_PREFIX_APXS + $(SED) 's%^prefix =.*%prefix = $(TARGET_DIR)/usr%' \ + $(STAGING_DIR)/usr/build/config_vars.mk
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli) · line 108
Quoted 10 lines
package/php/php.mk +10
-0+endef + +PHP_PRE_INSTALL_TARGET_HOOKS += PHP_SET_TARGET_PREFIX_APXS + +define PHP_SET_STAGING_PREFIX_APXS + $(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' \ + $(STAGING_DIR)/usr/build/config_vars.mk +endef + +PHP_POST_INSTALL_TARGET_HOOKS += PHP_SET_STAGING_PREFIX_APXS
This looks rather odd/ugly. Do we have a better solution for this?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com