Category Archives: PHP

php.net powered by myracloud.com

The official PHP.net site is now powered by myracloud.com. Thanks to Rasmus Lerdorf and Dan Brown for the support. php.net is hosted on a server in California. We have nodes very nearby which load content, optimize it, and then deliver it either directly to clients or send it to myracloud nodes in other parts of the world in a highly compressed format.

PHP FastCGI start script with LFS tags

Since Debian does not come with a start/stop script for PHP fastcgi I’m sharing my script which has been in use basically unmodified for 10 years or so. Latest additions are the LFS tags required by recent Debian/Ubuntus.

Put it into /etc/init.d/php-fastcgi and “ln -s /etc/init.d/php-fastcgi /etc/rc2.d/S10php-fastcgi”. Don’t forget “chmod +x /etc/init.d/php-fastcgi”.

#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-fastcgi
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:
# Default-Stop:
# X-Interactive:     false
# Short-Description: foo
### END INIT INFO

. /etc/profile

PHP_FCGI_CHILDREN=24
export PHP_FCGI_CHILDREN

PHP_FCGI_MAX_REQUESTS=20000
export PHP_FCGI_MAX_REQUESTS

pidfile=/var/run/php5.pid

# Socket path to have the webserver connect to
path=/dev/shm/.php.fastcgi

case $1 in
start)
  su www-data -c "exec /usr/bin/php-cgi -b $path" </dev/null >/dev/null 2>&1 &
  echo $! > $pidfile
;;
stop)
  killpid=`cat $pidfile`
  echo trying killing $killpid
  kill $killpid
;;
esac

exit 0