apache: add customization of MPM
PATCH v2 1/4 apache: add customization of MPM
MPM can be selected between event, prefork or worker
Set worker as the default one as it was before even if event MPM is better on system supporting thread safe polling
---
Changes v1 -> v2 (after review of Yann Morin):
- Do not use unneeded variables in Config.in and apache.mk
package/apache/Config.in | 28 ++++++++++++++++++++++++++++ package/apache/apache.mk | 10 +++++++++- 2 files changed, 37 insertions(+), 1 deletion(-)
package/apache/Config.in +28 -0
@@ -14,6 +14,34 @@ config BR2_PACKAGE_APACHE http://httpd.apache.org +if BR2_PACKAGE_APACHE + +choice + prompt "Multi-Processing Module (MPM)" + default BR2_PACKAGE_APACHE_MPM_WORKER + help + Select the Multi-Processing Module (MPM). + +config BR2_PACKAGE_APACHE_MPM_EVENT + bool "event" + help + A variant of the worker MPM with the goal of consuming threads + only for connections with active processing + +config BR2_PACKAGE_APACHE_MPM_PREFORK + bool "prefork" + help + Implements a non-threaded, pre-forking web server + +config BR2_PACKAGE_APACHE_MPM_WORKER + bool "worker" + help + Implements a hybrid multi-threaded multi-process web server + +endchoice + +endif + comment "apache needs a toolchain w/ dynamic library, threads" depends on BR2_USE_MMU depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
package/apache/apache.mk +9 -1
@@ -20,6 +20,14 @@ APACHE_CONF_ENV= \ ap_cv_void_ptr_lt_long=no \ PCRE_CONFIG=$(STAGING_DIR)/usr/bin/pcre-config +ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT),y) +APACHE_MPM = event +else ifeq ($(BR2_PACKAGE_APACHE_MPM_PREFORK),y) +APACHE_MPM = prefork +else +APACHE_MPM = worker +endif + APACHE_CONF_OPTS = \ --sysconfdir=/etc/apache2 \ --with-apr=$(STAGING_DIR)/usr \
@@ -31,7 +39,7 @@ APACHE_CONF_OPTS = \ --enable-mime-magic \ --without-suexec-bin \ --enable-mods-shared=all \ - --with-mpm=worker \ + --with-mpm=$(APACHE_MPM) \ --disable-lua \ --disable-luajit
Signature · 1 line
2.5.0
PATCH 2/4 php: rework selection of interfaces
Following suggestion of Yann Morin, rework selection of php interfaces:
use booleans instead of choice to be able to select multiple interfaces as they are not exclusive
--- package/php/Config.in | 40 +++++----------------------------------- package/php/php.mk | 8 ++++---- 2 files changed, 9 insertions(+), 39 deletions(-)
package/php/Config.in +5 -35
@@ -1,5 +1,6 @@ config BR2_PACKAGE_PHP bool "php" + select BR2_PACKAGE_PHP_SAPI_CGI if !BR2_PACKAGE_PHP_HAS_SAPI help PHP is a widely-used general-purpose scripting language that is especially suited for Web development
@@ -9,61 +10,30 @@ config BR2_PACKAGE_PHP if BR2_PACKAGE_PHP -config BR2_PACKAGE_PHP_CLI +# Helper to make sure at least one interface is selected. +config BR2_PACKAGE_PHP_HAS_SAPI bool -config BR2_PACKAGE_PHP_CGI - bool - -config BR2_PACKAGE_PHP_FPM - bool - -choice - prompt "Interface" - default BR2_PACKAGE_PHP_SAPI_CGI - help - Select the PHP interface(s). - config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI" # CGI uses fork() depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CGI help Common Gateway Interface config BR2_PACKAGE_PHP_SAPI_CLI bool "CLI" - select BR2_PACKAGE_PHP_CLI + select BR2_PACKAGE_PHP_HAS_SAPI help Command Line Interface config BR2_PACKAGE_PHP_SAPI_FPM bool "FPM" depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_FPM + select BR2_PACKAGE_PHP_HAS_SAPI help PHP-FPM (FastCGI Process Manager) -config BR2_PACKAGE_PHP_SAPI_CLI_CGI - bool "CGI and CLI" - # CGI uses fork() - depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CLI - select BR2_PACKAGE_PHP_CGI - help - Command line and Common gateway interfaces - -config BR2_PACKAGE_PHP_SAPI_CLI_FPM - bool "FPM and CLI" - depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CLI - select BR2_PACKAGE_PHP_FPM - help - Command line and PHP-FPM (FastCGI Process Manager) - -endchoice - source "package/php/Config.ext" endif
package/php/php.mk +4 -4
@@ -77,9 +77,9 @@ else PHP_CONF_ENV += ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=no endif -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CLI),,--disable-cli) -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CGI),,--disable-cgi) -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_FPM),--enable-fpm,--disable-fpm) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),,--disable-cgi) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm) ### Extensions PHP_CONF_OPTS += \
@@ -280,7 +280,7 @@ PHP_CONF_OPTS += \ PHP_DEPENDENCIES += jpeg libpng freetype endif -ifeq ($(BR2_PACKAGE_PHP_FPM),y) +ifeq ($(BR2_PACKAGE_PHP_SAPI_FPM),y) define PHP_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \ $(TARGET_DIR)/etc/init.d/S49php-fpm
Signature · 1 line
2.5.0
PATCH 2/4 php: rework selection of interfaces
Hi Fabrice,
Quoted 3 lines · Fabrice Fontaine
Following suggestion of Yann Morin, rework selection of php interfaces:
use booleans instead of choice to be able to select multiple interfaces as they are not exclusive
Maybe add something like:
The choice was introduced in commit fcdc9f891 to make sure at least one SAPI option was selected. Here, we use an auxiliary symbol BR2_PACKAGE_PHP_HAS_SAPI and CGI will be selected if this symbol is not set.
Quoted 19 lines
Signed-off-by Fabrice Fontaine <[email protected]>--- package/php/Config.in | 40 +++++----------------------------------- package/php/php.mk | 8 ++++---- 2 files changed, 9 insertions(+), 39 deletions(-)package/php/Config.in +1
-0@@ -1,5 +1,6 @@ config BR2_PACKAGE_PHP bool "php" + select BR2_PACKAGE_PHP_SAPI_CGI if !BR2_PACKAGE_PHP_HAS_SAPI help PHP is a widely-used general-purpose scripting language that is especially suited for Web development
package/php/Config.in config BR2_PACKAGE_PHP · line 14
Quoted 6 lines
package/php/Config.in +2
-1@@ -9,61 +10,30 @@ config BR2_PACKAGE_PHP if BR2_PACKAGE_PHP -config BR2_PACKAGE_PHP_CLI +# Helper to make sure at least one interface is selected. +config BR2_PACKAGE_PHP_HAS_SAPI
The name is not ideal, because it's actually _HAS_SAPI_EXCEPT_CGI. But that's
impossible to understand, so perhaps extend the comment with
# All SAPI options except CGI will select this symbol.
package/php/Config.in config BR2_PACKAGE_PHP · line 22
Quoted 10 lines
package/php/Config.in +0
-8bool -config BR2_PACKAGE_PHP_CGI - bool - -config BR2_PACKAGE_PHP_FPM - bool - -choice - prompt "Interface"
You should keep this as a comment, or alternatively change the prompts below to
include "Interface". Now it is just
[*] php
-*- CGI
[ ] CLI
[ ] FPM
Extensions --->which is not descriptive enough IMHO.
Quoted 16 lines
package/php/Config.in +1
-6- default BR2_PACKAGE_PHP_SAPI_CGI - help - Select the PHP interface(s). - config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI" # CGI uses fork() depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CGI help Common Gateway Interface config BR2_PACKAGE_PHP_SAPI_CLI bool "CLI" - select BR2_PACKAGE_PHP_CLI + select BR2_PACKAGE_PHP_HAS_SAPI
package/php/Config.in config BR2_PACKAGE_PHP · line 35
Quoted 10 lines
package/php/Config.in +1
-1help Command Line Interface config BR2_PACKAGE_PHP_SAPI_FPM bool "FPM" depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_FPM + select BR2_PACKAGE_PHP_HAS_SAPI help PHP-FPM (FastCGI Process Manager)
Isn't FPM mutually exclusive with CGI?
If yes, it could be tricky to code that in Config.in without a dependency cycle
due to HAS_SAPI...
package/php/Config.in config BR2_PACKAGE_PHP · line 53
Quoted 7 lines
package/php/Config.in +0
-6-config BR2_PACKAGE_PHP_SAPI_CLI_CGI - bool "CGI and CLI" - # CGI uses fork() - depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CLI - select BR2_PACKAGE_PHP_CGI
Any user-settable config symbol that is removed should move to
Config.in.legacy. Something like this:
config BR2_PACKAGE_PHP_SAPI_CLI_CGI
bool "PHP CGI and CLI option is split up" select BR2_PACKAGE_PHP_SAPI_CLI
select BR2_PACKAGE_PHP_SAPI_CGI
help
The PHP Interface options have been split up into a separate option for each interface.
package/php/Config.in config BR2_PACKAGE_PHP · line 57
Quoted 4 lines
package/php/Config.in +0
-4- help - Command line and Common gateway interfaces - -config BR2_PACKAGE_PHP_SAPI_CLI_FPM
Similar for this one.
Regards,
Arnout
Quoted 39 lines
package/php/Config.in +0
-9- bool "FPM and CLI" - depends on BR2_USE_MMU - select BR2_PACKAGE_PHP_CLI - select BR2_PACKAGE_PHP_FPM - help - Command line and PHP-FPM (FastCGI Process Manager) - -endchoice - source "package/php/Config.ext" endifpackage/php/php.mk +4
-4@@ -77,9 +77,9 @@ else PHP_CONF_ENV += ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=no endif -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CLI),,--disable-cli) -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CGI),,--disable-cgi) -PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_FPM),--enable-fpm,--disable-fpm) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),,--disable-cgi) +PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm) ### Extensions PHP_CONF_OPTS += \@@ -280,7 +280,7 @@ PHP_CONF_OPTS += \ PHP_DEPENDENCIES += jpeg libpng freetype endif -ifeq ($(BR2_PACKAGE_PHP_FPM),y) +ifeq ($(BR2_PACKAGE_PHP_SAPI_FPM),y) define PHP_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \ $(TARGET_DIR)/etc/init.d/S49php-fpm
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 3/4 php: fix pthread detection
In reply to Fabrice FontaineFollowing suggestion of Yann Morin, move fix on pthread detection in a detected patch and add more comment on issue: without this fix, thread safety option (--enable-maintainer-zts) will not work
--- package/php/php.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
package/php/php.mk +14 -0
@@ -47,6 +47,20 @@ define PHP_BUILDCONF endef PHP_PRE_CONFIGURE_HOOKS += PHP_BUILDCONF +# PHP assumes pthreads are not working when cross-compiling, indeed configure +# sets pthreads_working to no if cross_compiling is set to yes (line 5888) +# If pthreads_working is set to no, thread safety option +# (--enable-maintainer-zts) will not be available +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +PHP_CONF_ENV += ac_cv_pthreads_lib=pthread + +define PHP_FIX_THREADS_DETECTION + $(SED) 's/pthreads_working\=no/pthreads_working\=yes/' $(@D)/configure +endef + +PHP_PRE_CONFIGURE_HOOKS += PHP_FIX_THREADS_DETECTION +endif + ifeq ($(BR2_ENDIAN),"BIG") PHP_CONF_ENV += ac_cv_c_bigendian_php=yes else
Signature · 1 line
2.5.0
PATCH 3/4 php: fix pthread detection
Quoted 3 lines · Fabrice Fontaine
Following suggestion of Yann Morin, move fix on pthread detection in a detected patch and add more comment on issue: without this fix, thread safety option (--enable-maintainer-zts) will not work
This commit message makes no sense. I guess you wanted to say that in this v2,
you split off the pthread detection into a separate patch. But that should be in a non-commit comment (see below).
Better use the comment you added below as the commit message.
Quoted 2 lines
Signed-off-by Fabrice Fontaine <[email protected]>
You can add below your Sob
---
v2: move to a separate patch (Yann Morin)
Quoted 12 lines
--- package/php/php.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)package/php/php.mk +0
-0@@ -47,6 +47,20 @@ define PHP_BUILDCONF endef PHP_PRE_CONFIGURE_HOOKS += PHP_BUILDCONF
package/php/php.mk define PHP_BUILDCONF · line 59
Quoted 10 lines
package/php/php.mk +10
-0+# PHP assumes pthreads are not working when cross-compiling, indeed configure +# sets pthreads_working to no if cross_compiling is set to yes (line 5888) +# If pthreads_working is set to no, thread safety option +# (--enable-maintainer-zts) will not be available +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +PHP_CONF_ENV += ac_cv_pthreads_lib=pthread + +define PHP_FIX_THREADS_DETECTION + $(SED) 's/pthreads_working\=no/pthreads_working\=yes/' $(@D)/configure +endef
I'd prefer an upstreamable patch that fixes the issue. The problem is that the
configure script violates a rule of AC_CACHE_VAL: "The commands-to-set-it must have no side effects except for setting the variable cache-id, see below". But they also set pthreads_working, which is wrong. It completely defeats the purpose of the cache.
So what should be done is to remove the pthreads_working assignments from theAC_CACHE_CHECK functions, and replace them with:
if [ "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x" ]; then
pthreads_working=yes
fi
Regards,
Arnout
Quoted 8 lines
package/php/php.mk +4
-0+ +PHP_PRE_CONFIGURE_HOOKS += PHP_FIX_THREADS_DETECTION +endif + ifeq ($(BR2_ENDIAN),"BIG") PHP_CONF_ENV += ac_cv_c_bigendian_php=yes else
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v4 4/4 php: add apache support
In reply to Fabrice FontaineContinue work started by Bernd Kuhls in
https://patchwork.ozlabs.org/patch/437544/
---
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 | 7 +++++++ package/php/php.mk | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)
package/php/Config.in +7 -0
@@ -14,6 +14,13 @@ if BR2_PACKAGE_PHP config BR2_PACKAGE_PHP_HAS_SAPI bool +config BR2_PACKAGE_PHP_SAPI_APACHE + bool "Apache" + depends on BR2_PACKAGE_APACHE + select BR2_PACKAGE_PHP_HAS_SAPI + help + Apache module + config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI" # CGI uses fork()
package/php/php.mk +22 -0
@@ -95,6 +95,28 @@ PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_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 + +# php uses apxs from staging directory to install libphp dynamic library and +# update /etc/apache2/httpd.conf through the -a option, here is the full +# command line: "apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/modules' +# -S SYSCONFDIR='$(INSTALL_ROOT)/etc/apache2' -i -a -n php7 +# This does not work as apxs sets the full path of the library and not the +# relative one so remove -a option from apxs call +define PHP_REMOVE_APXS_UPDATE_CONF + $(SED) 's/-i -a -n php/-i -n php/' $(@D)/configure +endef + +PHP_PRE_CONFIGURE_HOOKS += PHP_REMOVE_APXS_UPDATE_CONF +endif + ### Extensions PHP_CONF_OPTS += \ $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \
Signature · 1 line
2.5.0
PATCH v4 4/4 php: add apache support
Quoted 56 lines · Fabrice Fontaine
Continue work started by Bernd Kuhls in
https://patchwork.ozlabs.org/patch/437544/Signed-off-by Bernd Kuhls <[email protected]>Signed-off-by Fabrice Fontaine <[email protected]>---
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 callChanges 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 pathpackage/php/Config.in | 7 +++++++ package/php/php.mk | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)package/php/Config.in +7
-0@@ -14,6 +14,13 @@ if BR2_PACKAGE_PHP config BR2_PACKAGE_PHP_HAS_SAPI bool +config BR2_PACKAGE_PHP_SAPI_APACHE + bool "Apache" + depends on BR2_PACKAGE_APACHE + select BR2_PACKAGE_PHP_HAS_SAPI + help + Apache module + config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI" # CGI uses fork()package/php/php.mk +5
-0@@ -95,6 +95,28 @@ PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_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
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) · line 112
Quoted 10 lines
package/php/php.mk +10
-0+ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT)$(BR2_PACKAGE_APACHE_MPM_WORKER),y) +PHP_CONF_OPTS += --enable-maintainer-zts +endif + +# php uses apxs from staging directory to install libphp dynamic library and +# update /etc/apache2/httpd.conf through the -a option, here is the full +# command line: "apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/modules' +# -S SYSCONFDIR='$(INSTALL_ROOT)/etc/apache2' -i -a -n php7 +# This does not work as apxs sets the full path of the library and not the +# relative one so remove -a option from apxs call
Isn't the proper solution to add apxs to APACHE_CONFIG_SCRIPTS? Or is the
staging dir encoded in a way that our sed script doesn't find it?
Regards,
Arnout
Quoted 11 lines
package/php/php.mk +7
-0+define PHP_REMOVE_APXS_UPDATE_CONF + $(SED) 's/-i -a -n php/-i -n php/' $(@D)/configure +endef + +PHP_PRE_CONFIGURE_HOOKS += PHP_REMOVE_APXS_UPDATE_CONF +endif + ### Extensions PHP_CONF_OPTS += \ $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v4 4/4 php: add apache support
Dear Arnout,
You're right that the issue is linked to apxs however adding apxs to APACHE_CONFIG_SCRIPTS does not solve the issue.
I'll try to explain the problem. At the moment, the configuration file of apxs, config_vars.mk, is patched in APACHE_FIX_STAGING_APACHE_CONFIG to add STAGING_DIR as a prefix so apxs adds the correct LoadModule directive in output/staging/etc/apache2/httpd.conf through the following command:
output/staging/usr/bin/apxs -S LIBEXECDIR='/home/fabrice/buildroot-qemu/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/modules' -S SYSCONFDIR='/home/fabrice/buildroot-qemu/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/etc/apache2' -i -a -n php7 output/build/php-7.0.9/libs/libphp7.so
However, the same apxs in staging directory is also used to update the output/target/etc/apache2/httpd.conf through the following command:
output/staging/usr/bin/apxs -S LIBEXECDIR='/home/fabrice/buildroot-qemu/output/staging/usr/modules' -S SYSCONFDIR='/home/fabrice/buildroot-qemu/output/staging/etc/apache2' -i -a -n php7 output/build/php-7.0.9/libs/libphp7.so
In this case, the prefix is wrong and apxs adds a wrong path in the LoadModule directive.
We could fix the issue by updating APACHE_FIX_STAGING_APACHE_CONFIG to use the TARGET_DIR instead of the STAGING_DIR. However, Yann's point of view was that php package should not update apache configuration file. So, I will let you decide what should be done.
Best Regards,
he binary is correctly patched to install
2016-09-12 1:30 GMT+02:00 Arnout Vandecappelle <[email protected]>:
Quoted 94 lines · Fabrice Fontaine
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,-
Quoted 48 lines
Continue work started by Bernd Kuhls in
https://patchwork.ozlabs.org/patch/437544/Signed-off-by Bernd Kuhls <[email protected]>Signed-off-by Fabrice Fontaine <[email protected]>---
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 callChanges 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 pathpackage/php/Config.in | 7 +++++++ package/php/php.mk | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)package/php/Config.in +7
-0@@ -14,6 +14,13 @@ if BR2_PACKAGE_PHP config BR2_PACKAGE_PHP_HAS_SAPI bool +config BR2_PACKAGE_PHP_SAPI_APACHE + bool "Apache" + depends on BR2_PACKAGE_APACHE + select BR2_PACKAGE_PHP_HAS_SAPI + help + Apache module + config BR2_PACKAGE_PHP_SAPI_CGI bool "CGI" # CGI uses fork()package/php/php.mk +0
-0@@ -95,6 +95,28 @@ PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli)
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,- · line 96
Quoted 2 lines
package/php/php.mk +0
-0PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),,--disable-cgi) PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm)
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli)
Quoted 7 lines
package/php/php.mk +6
-0+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)
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli)
Quoted 4 lines
package/php/php.mk +4
-0+PHP_CONF_OPTS += --enable-maintainer-zts +endif + +# php uses apxs from staging directory to install libphp dynamiclibrary and
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli)
Quoted 4 lines
package/php/php.mk +4
-0+# update /etc/apache2/httpd.conf through the -a option, here is the full +# command line: "apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/modules' +# -S SYSCONFDIR='$(INSTALL_ROOT)/etc/apache2' -i -a -n php7 +# This does not work as apxs sets the full path of the library and notthe
package/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli) · line 112
Quoted 1 line
package/php/php.mk +1
-0+# relative one so remove -a option from apxs callIsn't the proper solution to add apxs to
APACHE_CONFIG_SCRIPTS? Or is the
staging dir encoded in a way that our sed script doesn't find it?Regards,
Arnoutpackage/php/php.mk PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),,--disable-cli)
Quoted 11 lines
package/php/php.mk +7
-0+define PHP_REMOVE_APXS_UPDATE_CONF + $(SED) 's/-i -a -n php/-i -n php/' $(@D)/configure +endef + +PHP_PRE_CONFIGURE_HOOKS += PHP_REMOVE_APXS_UPDATE_CONF +endif + ### Extensions PHP_CONF_OPTS += \ $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \--
Quoted 7 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160913/8128dead/attachment-0001.html>
PATCH v4 4/4 php: add apache support
[Please don't top-post, but answer inline.]
Quoted 17 lines · Fabrice Fontaine
Dear Arnout,
You're right that the issue is linked to apxs however adding apxs to
APACHE_CONFIG_SCRIPTSdoes not solve the issue.I'll try to explain the problem. At the moment, the configuration file of apxs, config_vars.mk <http://config_vars.mk>, is patched in
APACHE_FIX_STAGING_APACHE_CONFIGto addSTAGING_DIRas a prefix so apxs adds the correct LoadModule directive inoutput/staging/etc/apache2/httpd.confthrough the following command:output/staging/usr/bin/apxs -S LIBEXECDIR='/home/fabrice/buildroot-qemu/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/modules' -S SYSCONFDIR='/home/fabrice/buildroot-qemu/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/etc/apache2' -i -a -n php7 output/build/php-7.0.9/libs/libphp7.so
Quoted 6 lines
However, the same apxs in staging directory is also used to update the
output/target/etc/apache2/httpd.confthrough the following command:
output/staging/usr/bin/apxs -S LIBEXECDIR='/home/fabrice/buildroot-qemu/output/staging/usr/modules' -S SYSCONFDIR='/home/fabrice/buildroot-qemu/output/staging/etc/apache2' -i -a -n php7 output/build/php-7.0.9/libs/libphp7.so
I guess here you meant target instead of staging...
Quoted 3 lines
In this case, the prefix is wrong and apxs adds a wrong path in the LoadModule directive.
So that's the crux of the matter. apxs is smart enough to subsitute away prefix:
my $dir = $CFG_LIBEXECDIR;
$dir =~ s|^$CFG_PREFIX/?||;However, for the target install, LIBEXECDIR is overridden to the target directory, but PREFIX remains as staging directory.
I've done a quick test, and passing an additional -S PREFIX $(TARGET_DIR)/usr
for the target install seems to fix it. Now, is there a way to push this option down to the target install (only)?
Quoted 4 lines
We could fix the issue by updating
APACHE_FIX_STAGING_APACHE_CONFIGto use theTARGET_DIRinstead of theSTAGING_DIR. However, Yann's point of view was that php package should not update apache configuration file. So, I will let you decide what should be done.
IMHO, Yann was wrong in that. It's very normal that package a that depends on
package b will update some file that was originally generated by package b.
That said, it is very convenient to use an approach like e.g. Debian, where
each module has its own conf file, and can be enabled by linking to the conf file from /etc/apache2/mods-enabled. But that means we have to make a httpd.conf which is very different from upstream's.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/4 apache: add customization of MPM
In reply to Fabrice FontaineQuoted 5 lines · Fabrice Fontaine
MPM can be selected between event, prefork or worker
Set worker as the default one as it was before even if event MPM is better on system supporting thread safe pollingSigned-off-by Fabrice Fontaine <[email protected]>
Perhaps the default should change to 'event', however?
Regards,
Arnout
Quoted 76 lines
---
Changes v1 -> v2 (after review of Yann Morin):
- Do not use unneeded variables in Config.in and apache.mkpackage/apache/Config.in | 28 ++++++++++++++++++++++++++++ package/apache/apache.mk | 10 +++++++++- 2 files changed, 37 insertions(+), 1 deletion(-)package/apache/Config.in +28
-0@@ -14,6 +14,34 @@ config BR2_PACKAGE_APACHE http://httpd.apache.org +if BR2_PACKAGE_APACHE + +choice + prompt "Multi-Processing Module (MPM)" + default BR2_PACKAGE_APACHE_MPM_WORKER + help + Select the Multi-Processing Module (MPM). + +config BR2_PACKAGE_APACHE_MPM_EVENT + bool "event" + help + A variant of the worker MPM with the goal of consuming threads + only for connections with active processing + +config BR2_PACKAGE_APACHE_MPM_PREFORK + bool "prefork" + help + Implements a non-threaded, pre-forking web server + +config BR2_PACKAGE_APACHE_MPM_WORKER + bool "worker" + help + Implements a hybrid multi-threaded multi-process web server + +endchoice + +endif + comment "apache needs a toolchain w/ dynamic library, threads" depends on BR2_USE_MMU depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADSpackage/apache/apache.mk +9
-1@@ -20,6 +20,14 @@ APACHE_CONF_ENV= \ ap_cv_void_ptr_lt_long=no \ PCRE_CONFIG=$(STAGING_DIR)/usr/bin/pcre-config +ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT),y) +APACHE_MPM = event +else ifeq ($(BR2_PACKAGE_APACHE_MPM_PREFORK),y) +APACHE_MPM = prefork +else +APACHE_MPM = worker +endif + APACHE_CONF_OPTS = \ --sysconfdir=/etc/apache2 \ --with-apr=$(STAGING_DIR)/usr \@@ -31,7 +39,7 @@ APACHE_CONF_OPTS = \ --enable-mime-magic \ --without-suexec-bin \ --enable-mods-shared=all \ - --with-mpm=worker \ + --with-mpm=$(APACHE_MPM) \ --disable-lua \ --disable-luajit
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/4 apache: add customization of MPM
In reply to Fabrice FontaineHello,
package/apache/apache.mk APACHE_CONF_ENV= \ · line 27
Quoted 5 lines · Fabrice Fontaine
package/apache/apache.mk +5
-0+ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT),y) +APACHE_MPM = event +else ifeq ($(BR2_PACKAGE_APACHE_MPM_PREFORK),y) +APACHE_MPM = prefork +else
I've changed this to:
else ifeq ($(BR2_PACKAGE_APACHE_MPM_WORKER),y)
just for the sake of consistency. And then I've applied your patch. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com