aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-eselect/eselect-php/files')
-rw-r--r--app-eselect/eselect-php/files/70_mod_php5.conf-apache214
-rw-r--r--app-eselect/eselect-php/files/70_mod_php5.conf-apache2-r118
-rw-r--r--app-eselect/eselect-php/files/php-fpm-launcher7
-rwxr-xr-xapp-eselect/eselect-php/files/php-fpm-r1.init50
-rw-r--r--app-eselect/eselect-php/files/php-fpm.conf1
-rw-r--r--app-eselect/eselect-php/files/php-fpm_at.service14
6 files changed, 104 insertions, 0 deletions
diff --git a/app-eselect/eselect-php/files/70_mod_php5.conf-apache2 b/app-eselect/eselect-php/files/70_mod_php5.conf-apache2
new file mode 100644
index 00000000..7ec8739c
--- /dev/null
+++ b/app-eselect/eselect-php/files/70_mod_php5.conf-apache2
@@ -0,0 +1,14 @@
+<IfDefine PHP5>
+ # Load the module first
+ <IfModule !mod_php5.c>
+ LoadModule php5_module modules/libphp5.so
+ </IfModule>
+
+ # Set it to handle the files
+ <IfModule mod_mime.c>
+ AddHandler application/x-httpd-php .php .php5 .phtml
+ AddHandler application/x-httpd-php-source .phps
+ </IfModule>
+
+ DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/app-eselect/eselect-php/files/70_mod_php5.conf-apache2-r1 b/app-eselect/eselect-php/files/70_mod_php5.conf-apache2-r1
new file mode 100644
index 00000000..05deeb6e
--- /dev/null
+++ b/app-eselect/eselect-php/files/70_mod_php5.conf-apache2-r1
@@ -0,0 +1,18 @@
+<IfDefine PHP5>
+ # Load the module first
+ <IfModule !mod_php5.c>
+ LoadModule php5_module modules/libphp5.so
+ </IfModule>
+
+ # Set it to handle the files
+ # NOTE: Avoiding AddHandler/AddType for security (bug #538822)
+ # NOTE: Please read the related news item!
+ <FilesMatch "\.(php|php5|phtml)$">
+ SetHandler application/x-httpd-php
+ </FilesMatch>
+ <FilesMatch "\.phps$">
+ SetHandler application/x-httpd-php-source
+ </FilesMatch>
+
+ DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/app-eselect/eselect-php/files/php-fpm-launcher b/app-eselect/eselect-php/files/php-fpm-launcher
new file mode 100644
index 00000000..7a1c1c9f
--- /dev/null
+++ b/app-eselect/eselect-php/files/php-fpm-launcher
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+PHPSLOT="${1}"
+[ -z "${PHPSLOT}" ] && PHPSLOT="$(eselect php show fpm)"
+shift
+
+exec /usr/lib/${PHPSLOT}/bin/php-fpm "${@}"
diff --git a/app-eselect/eselect-php/files/php-fpm-r1.init b/app-eselect/eselect-php/files/php-fpm-r1.init
new file mode 100755
index 00000000..ab0693ec
--- /dev/null
+++ b/app-eselect/eselect-php/files/php-fpm-r1.init
@@ -0,0 +1,50 @@
+#!/sbin/runscript
+
+set_phpvars() {
+ PHPSLOT=${SVCNAME#php-fpm-}
+ PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"
+ if [ ${PHPSLOT} = 'php-fpm' ] ; then
+ PHPSLOT="$(eselect php show fpm)"
+ PHP_FPM_PID="/var/run/php-fpm.pid"
+ fi
+
+ PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
+}
+
+extra_commands="depend"
+extra_started_commands="reload"
+
+depend() {
+ need net
+ use apache2 lighttpd nginx
+}
+
+start() {
+ ebegin "Starting PHP FastCGI Process Manager"
+ set_phpvars
+ start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \
+ /usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}"
+ local i=0
+ local timeout=5
+ while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do
+ sleep 1
+ i=$(($i + 1))
+ done
+
+ [ $timeout -gt $i ]
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping PHP FastCGI Process Manager"
+ set_phpvars
+ start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading PHP FastCGI Process Manager"
+ set_phpvars
+ [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
+ eend $?
+}
diff --git a/app-eselect/eselect-php/files/php-fpm.conf b/app-eselect/eselect-php/files/php-fpm.conf
new file mode 100644
index 00000000..d7ad9654
--- /dev/null
+++ b/app-eselect/eselect-php/files/php-fpm.conf
@@ -0,0 +1 @@
+d /var/run/php-fpm 755 root root
diff --git a/app-eselect/eselect-php/files/php-fpm_at.service b/app-eselect/eselect-php/files/php-fpm_at.service
new file mode 100644
index 00000000..cba3321c
--- /dev/null
+++ b/app-eselect/eselect-php/files/php-fpm_at.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=The PHP FastCGI Process Manager
+After=network.target
+
+[Service]
+Type=notify
+PIDFile=/var/run/php-fpm/php-fpm-%I.pid
+ExecStart=/usr/libexec/php-fpm-launcher php%I -y /etc/php/fpm-php%I/php-fpm.conf --nodaemonize
+ExecReload=/bin/kill -USR2 $MAINPID
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
+