Hi I have installed PHP 5.6.40 /php-fpm as an additional php version on my Ubuntu 14.04 LTS server (I know these are out of date but for reasons I cannot go into here I need to maintain this at these versions for the time being...) I set this up using https://www.howtoforge.com/how-to-u...fpm-and-fastcgi-with-ispconfig-3-ubuntu-12.10 with minor amendments... Whenever I create a new site (with ispconfig 3.1.15) using this php version or switch an existing site that was using the system default php version, I get a fatal error that looks like this: [fastcgi:error] [pid 15645] (2)No such file or directory: [client 86.185.157.0:2817] FastCGI: failed to connect to server "/var/www/clients/client8/web53/cgi-bin/php-fcgi-*-80-nnnnn.co.uk": connect() failed [fastcgi:error] [pid 15645] [client 86.185.157.0:2817] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client8/web53/cgi-bin/php-fcgi-*-80-nnnnn.co.uk" (any reason why the error shows up as fast-cgi even though I am using FPM? I don't really understand the difference to be honest) FYI ports are like this (I have several versions of PHP installed): # sudo lsof -i -P -n | grep php php-fpm 3571 root 7u IPv4 14935 0t0 TCP 127.0.0.1:8999 (LISTEN) php-fpm 3572 www-data 0u IPv4 14935 0t0 TCP 127.0.0.1:8999 (LISTEN) php-fpm 3573 www-data 0u IPv4 14935 0t0 TCP 127.0.0.1:8999 (LISTEN) php-fpm 3576 root 7u IPv4 16090 0t0 TCP 127.0.0.1:9001 (LISTEN) php-fpm 3577 www-data 0u IPv4 16090 0t0 TCP 127.0.0.1:9001 (LISTEN) php-fpm 3578 www-data 0u IPv4 16090 0t0 TCP 127.0.0.1:9001 (LISTEN) php-fpm 3793 root 7u IPv4 16251 0t0 TCP 127.0.0.1:8998 (LISTEN) php-fpm 3794 www-data 0u IPv4 16251 0t0 TCP 127.0.0.1:8998 (LISTEN) php-fpm 3795 www-data 0u IPv4 16251 0t0 TCP 127.0.0.1:8998 (LISTEN) php-fpm 16155 root 9u IPv4 16382 0t0 TCP 127.0.0.1:9000 (LISTEN) php-fpm 16165 www-data 0u IPv4 16382 0t0 TCP 127.0.0.1:9000 (LISTEN) php-fpm 16166 www-data 0u IPv4 16382 0t0 TCP 127.0.0.1:9000 (LISTEN) Any ideas what might be causing the problem and what I might do to fix it?
This is PHP-FPM and not fastCGI. The PHP-FPM Module of apache is named mod_fastcgi. Regarding the original error, it seems as if your custom PHP FPM is either not running or it fails to deliver the result back to apache
Till it appears oyu are right that it is not actually running. I tried to stop and restart the php service but it said there was no pid file found and then said that the address (port) was already in use. There are no processes using this port however according to netstat.... puzzled
I don't use Debian/Ubuntu but I just assume that the php packages don't differ as much as in CentOS. So, what could be case is that your first/vanilla php-fpm process is using an already used port. Have a look in the www.conf files of each php-fpm service you use and make sure that they are using ports that are not yet in use.
What I now realise is that each time I attempt to start php-fpm on a new port it fails to start - giving me " ERROR: An another FPM instance seems to already listen on /var/lib/php5-fpm/web55.sock" and then hangs up the port for subsequent use...
...don't really understand why it's trying to use a socket - I have it configured to listen= 127.0.0.1:9003
OK - this php-fpm version is being started on reboot (according to logs) and is working fine. It's just that the init.d script I have created based on https://www.howtoforge.com/how-to-u...fpm-and-fastcgi-with-ispconfig-3-ubuntu-12.10 is not working - if I try to stop or reload it responds "no pid file found - php-fpm is not running ?" and causes errors if I try to start (naturally) saying 'address is already in use' - as it is It would be nice to have this script working so I can stop and start php without rebooting... Also a status option would be good... here is what it currently looks like: #! /bin/sh ### BEGIN INIT INFO # Provides: php-5.6.40-fpm # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts php-5.6.40-fpm # Description: starts the PHP FastCGI Process Manager daemon ### END INIT INFO php_fpm_BIN=/opt/php-5.6.40/sbin/php-fpm php_fpm_CONF=/opt/php-5.6.40/etc/php-fpm.conf php_fpm_PID=/opt/php-5.6.40/var/run/php-fpm.pid php_opts="--fpm-config $php_fpm_CONF" wait_for_pid () { try=0 while test $try -lt 35 ; do case "$1" in 'created') if [ -f "$2" ] ; then try='' break fi ;; 'removed') if [ ! -f "$2" ] ; then try='' break fi ;; esac echo -n . try=`expr $try + 1` sleep 1 done } case "$1" in start) echo -n "Starting php-fpm " $php_fpm_BIN $php_opts if [ "$?" != 0 ] ; then echo " failed" exit 1 fi wait_for_pid created $php_fpm_PID if [ -n "$try" ] ; then echo " failed" exit 1 else echo " done" fi ;; stop) echo -n "Gracefully shutting down php-fpm " if [ ! -r $php_fpm_PID ] ; then echo "warning, no pid file found - php-fpm is not running ?" exit 1 fi kill -QUIT `cat $php_fpm_PID` wait_for_pid removed $php_fpm_PID if [ -n "$try" ] ; then echo " failed. Use force-exit" exit 1 else echo " done" echo " done" fi ;; force-quit) echo -n "Terminating php-fpm " if [ ! -r $php_fpm_PID ] ; then echo "warning, no pid file found - php-fpm is not running ?" exit 1 fi kill -TERM `cat $php_fpm_PID` wait_for_pid removed $php_fpm_PID if [ -n "$try" ] ; then echo " failed" exit 1 else echo " done" fi ;; restart) $0 stop $0 start ;; reload) echo -n "Reload service php-fpm " if [ ! -r $php_fpm_PID ] ; then echo "warning, no pid file found - php-fpm is not running ?" exit 1 fi kill -USR2 `cat $php_fpm_PID` echo " done" ;; *) echo "Usage: $0 {start|stop|force-quit|restart|reload}" exit 1 ;; esac
It doesn't help with the init scripts in your current setup, but i can wholeheartedly recommend installing additional php versions from the repositories at sury.org, they're easier to install, regularly updated, and the init scripts work without issue.