Page 1 of 1

PHP FastCGI

Posted: Fri May 01, 2009 11:20 am
by Fundaev
Hi there!

I am trying to run PHP with Nginx, i.e. with FastCGI mode. For that I compiled it with these options:

--enable-fastcgi --enable-force-cgi-redirect --enable-discard-path

Now to run PHP I type this command:

Code: Select all

 
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
               --background --make-pidfile --chuid $EXEC_AS_USER --startas $DAEMON
 
here $DAEMON is the absolute path to the "php-cgi" file.

Next, as for the "nginx.conf" file, this is its part:

Code: Select all

 
location ~ \.php$ {
           fastcgi_pass   127.0.0.1:1026;
           fastcgi_index  index.php;
           fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
           include        /usr/local/nginx/conf/fastcgi_params;
       }
 
In fact I made the same actions, described here http://blog.codefront.net/2007/06/11/ng ... it-script/

Now Nginx is successfully ran. However when I try to run the PHP-script, the header #502 is returned. Does anybody know how to fix it?

Thank you in advance.

P.S. PHP 5.2.9, Nginx 0.6.36, OS Kubuntu 8.10

Re: PHP FastCGI

Posted: Sun May 03, 2009 10:14 am
by Fundaev
It seems I've just fixed it!