php: add apache support
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sun, 11 Dec 2016 22:29:16 +0000 (23:29 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 12 Dec 2016 21:46:19 +0000 (22:46 +0100)
Continue work started by Bernd Kuhls in
https://patchwork.ozlabs.org/patch/437544/

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/php/0009-Call-apxs-with-correct-prefix.patch [new file with mode: 0644]
package/php/Config.in
package/php/php.mk

diff --git a/package/php/0009-Call-apxs-with-correct-prefix.patch b/package/php/0009-Call-apxs-with-correct-prefix.patch
new file mode 100644 (file)
index 0000000..b850ab7
--- /dev/null
@@ -0,0 +1,49 @@
+From 4342bdea7a1a21430ce0d051fa4387441166c473 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Sun, 11 Dec 2016 23:12:46 +0100
+Subject: [PATCH] Call apxs with correct prefix
+
+php uses apache's apxs script from staging directory to install libphp
+dynamic library and update /etc/apache2/httpd.conf in the staging and target
+directories. 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 for target directory as apxs sets the full path of the
+library and not the relative one. Indeed, apxs is smart enough to substitute
+away the prefix specified in $(STAGING_DIR)/usr/build/config_vars.mk so
+httpd.conf will only be correct in the staging directory.
+To fix this, add -S PREFIX='$(INSTALL_ROOT)/usr' to apxs call in configure
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ sapi/apache2handler/config.m4 | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
+index 2e64b21..f5bf002 100644
+--- a/sapi/apache2handler/config.m4
++++ b/sapi/apache2handler/config.m4
+@@ -66,10 +66,12 @@ if test "$PHP_APXS2" != "no"; then
+     AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
+   fi
++  APXS_PREFIX='$(INSTALL_ROOT)'/usr
+   APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
+   if test -z `$APXS -q SYSCONFDIR`; then
+     INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
+                  $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
++                       -S PREFIX='$APXS_PREFIX' \
+                        -i -n php7"
+   else
+     APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
+@@ -77,6 +79,7 @@ if test "$PHP_APXS2" != "no"; then
+                 \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+                  $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+                        -S SYSCONFDIR='$APXS_SYSCONFDIR' \
++                       -S PREFIX='$APXS_PREFIX' \
+                        -i -a -n php7"
+   fi
+-- 
+2.5.0
+
index 57dabc435f56ab49efe177f706c9a866e8704c58..0fb80063af3fee45b07183e8f546670e2b4e4644 100644 (file)
@@ -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,12 @@ config BR2_PACKAGE_PHP
 
 if BR2_PACKAGE_PHP
 
+config BR2_PACKAGE_PHP_SAPI_APACHE
+       bool "Apache interface"
+       depends on BR2_PACKAGE_APACHE
+       help
+         Apache module
+
 config BR2_PACKAGE_PHP_SAPI_CGI
        bool "CGI interface"
        # CGI uses fork()
index 8c1ccef68c6f30f87a0207c960880f04e7c1dabb..e8c8f4b779439c95c1d4039274b9acf130b5a5bd 100644 (file)
@@ -81,6 +81,16 @@ 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
+endif
+
 ### Extensions
 PHP_CONF_OPTS += \
        $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \