linux/scripts/init/php-cgi

27 lines
673 B
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: php-cgi
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: PHP FastCGI Version <= 5.2 on a socket
# X-Author: Adrian Kousz, 2014
### END INIT INFO
USER=www-data
PIDFILE=/run/php-cgi.pid
LOGFILE=/var/log/php-cgi.log
SOCKET=/tmp/php-fastcgi.sock
CMD="PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=2000 php-cgi -b '$SOCKET' -c /etc/php5/fastcgi/php.ini"
if [ "$1" = 'start' ]; then
GROUP=$(id -gn $USER)
mkdir -m 0700 /dev/shm/phpsess
chown $USER:$GROUP /dev/shm/phpsess
fi
/etc/initscript/regular.sh "$1" "$PIDFILE" "$LOGFILE" "$USER" "$CMD"