diff --git a/build.sh b/build.sh index a214c32..3f7731e 100755 --- a/build.sh +++ b/build.sh @@ -19,6 +19,7 @@ sudo apt-get install -y \ libjpeg-dev \ libpng-dev \ libpspell-dev \ + libsystemd-daemon-dev \ libreadline-dev sudo mkdir /usr/local/php7 @@ -64,6 +65,7 @@ CONFIGURE_STRING="--prefix=/usr/local/php7 \ --with-readline \ --with-curl \ --enable-fpm \ + --with-fpm-systemd \ --with-fpm-user=www-data \ --with-fpm-group=www-data" diff --git a/conf/php7-fpm-checkconf b/conf/php7-fpm-checkconf new file mode 100755 index 0000000..dff3c36 --- /dev/null +++ b/conf/php7-fpm-checkconf @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +errors=$(/usr/local/php7/sbin/php-fpm --fpm-config /usr/local/php7/etc/php-fpm.conf -t 2>&1 | grep "\[ERROR\]" || true); +if [ -n "$errors" ]; then + echo "Please fix your configuration file…" + echo $errors + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/conf/php7-fpm.service b/conf/php7-fpm.service new file mode 100644 index 0000000..3fe8671 --- /dev/null +++ b/conf/php7-fpm.service @@ -0,0 +1,13 @@ +[Unit] +Description=The PHP 7 FastCGI Process Manager +After=network.target + +[Service] +Type=notify +PIDFile=/var/run/php7-fpm.pid +ExecStartPre=/usr/local/lib/php7-fpm-checkconf +ExecStart=/usr/local/php7/sbin/php-fpm --fpm-config /usr/local/php7/etc/php-fpm.conf +ExecReload=/bin/kill -USR2 $MAINPID + +[Install] +WantedBy=multi-user.target \ No newline at end of file