2016-04-07 23:05 GMT+02:00 Mathieu Parent (Debian) <sath...@debian.org>:
> 2016-04-07 12:57 GMT+02:00 Ondřej Surý <ond...@sury.org>:
>> Hi Mathieu,
[...]

Hello Ondřej,

Please consider the atatched patches.I've tested that they work if:
- only php7.0-fpm is installed
- only libapache2-mod-php7.0 is installed
- both are installed

Notes:
- if both are installed, -fpm wins
- if apache2 is installed after -fpm, -fpm is not activated

Regards

-- 
Mathieu Parent
From d685d93f2eff841245dc737788752b04bd0cbff9 Mon Sep 17 00:00:00 2001
From: Mathieu Parent <math.par...@gmail.com>
Date: Sun, 17 Apr 2016 03:54:15 +0200
Subject: [PATCH 3/3] Enable mod_proxy_fcgi for php-fpm

---
 debian/php-fpm.postinst.extra | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/php-fpm.postinst.extra b/debian/php-fpm.postinst.extra
index 9394363..5895ce9 100644
--- a/debian/php-fpm.postinst.extra
+++ b/debian/php-fpm.postinst.extra
@@ -3,6 +3,7 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
 
     php_enable() {
 	# Enable PHP FPM by default when Apache 2 is installed
+	apache2_invoke enmod proxy_fcgi
 	return 0
     }
 else
-- 
2.8.0.rc3

From 8c4d5af805709b923c2c64cf64d87347d877264e Mon Sep 17 00:00:00 2001
From: Mathieu Parent <math.par...@gmail.com>
Date: Thu, 7 Apr 2016 22:57:41 +0200
Subject: [PATCH 2/3] Only use fpm SetHandler when it works

i.e when mod_proxy_fcgi is loaded
---
 debian/php-fpm.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/php-fpm.conf b/debian/php-fpm.conf
index 32c1119..cc8c7ab 100644
--- a/debian/php-fpm.conf
+++ b/debian/php-fpm.conf
@@ -1,5 +1,5 @@
 # Redirect to local php-fpm if mod_php is not available
-<IfModule !mod_php@PHP_MAJOR@.c>
+<IfModule proxy_fcgi_module>
     # Enable http authorization headers
     SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
 
-- 
2.8.0.rc3

From 44b95cfce8a7627fb765dcf652a4713aa566f044 Mon Sep 17 00:00:00 2001
From: Mathieu Parent <math.par...@gmail.com>
Date: Sun, 17 Apr 2016 03:42:02 +0200
Subject: [PATCH 1/3] Revert "Don't enable PHP FPM by default"

This reverts commit 4c4736beed2d0151d69aadbfc156a9d9b3df05c1.
---
 debian/php-fpm.postinst.extra | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/debian/php-fpm.postinst.extra b/debian/php-fpm.postinst.extra
index 9e017b3..9394363 100644
--- a/debian/php-fpm.postinst.extra
+++ b/debian/php-fpm.postinst.extra
@@ -1,7 +1,16 @@
-php_enable() {
-    # Don't enable PHP FPM by default
-    return 1
-}
+if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+    . /usr/share/apache2/apache2-maintscript-helper
+
+    php_enable() {
+	# Enable PHP FPM by default when Apache 2 is installed
+	return 0
+    }
+else
+    php_enable() {
+	# Don't enable PHP FPM by default when Apache 2 is not installed
+	return 1
+    }
+fi
 
 if [ "$1" = "triggered" ] && [ "$2" = "/etc/php/@PHP_VERSION@/fpm/conf.d" ]; then
     invoke-rc.d php@PHP_VERSION@-fpm restart
-- 
2.8.0.rc3

Reply via email to