I've installed Debian Wheezy and downgraded php5.4 to php5.3, and wanted to use fastCgi instead of php-fpm since it is not included in php5.3 package.
now I run into a little issue and can't seem to find a way around it. This issue is unix:/var/run/php-fpm/php-fpm.sock can't be created.
I have created a file for UNIX socket /usr/bin/php-fastcgi
#!/bin/bash
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
SOCKET=/var/run/php-fastcgi/php-fastcgi.socket
PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid
CHILDREN=6
PHP5=/usr/bin/php5-cgi
/usr/bin/spawn-fcgi -s $SOCKET -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5
And this my Nginx vhost:
server {
server_name www.mydomain.com mydomain.com;
root /srv/www/www.example.com/public_html;
location / {
index index.html index.htm;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
}
The main issue is always this:
connect() to unix:/var/run/php-fastcgi/php-fastcgi.socket failed (2: No such file or directory)
And this is for Enable and Start fastcgi service:
#!/bin/bash
### BEGIN INIT INFO
# Provides: php-fcgi
# Required-Start: $nginx
# Required-Stop: $nginx
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php over fcgi
# Description: starts php over fcgi
### END INIT INFO
(( EUID )) && echo .You need to have root priviliges.. && exit 1
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=10
PHP_FCGI_MAX_REQUESTS=10000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
start() {
echo -n "Starting PHP FastCGI: "
start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
RETVAL=$?
echo "$PHP_CGI_NAME."
}
stop() {
echo -n "Stopping PHP FastCGI: "
killall -q -w -u $USER $PHP_CGI
RETVAL=$?
echo "$PHP_CGI_NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
I'm wondering what is missing??
any comment is appreciated!!