nginx + fastcgi PHP

I recently migrated vm1 to nginx instead of lighttpd. Just for the sake of playing and testing around.

As there’s a PHP page as well, I had to set up fastcgi with PHP. I mainly followed this tutorial to try to get PHP working.

However, every PHP page I visited returned following error:

No input file specified.

As I was fairly sure it was path (or variable) related, I played around with:

fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;

Changing $document_root to the full path, etc, without success.

However, as I used the init script in the tutorial, and read a few posts about possible permission errors, I tried adding the group to the fastcgi daemon starter as well.

Change this:

start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS

to:

start-stop-daemon --quiet --start --background --chuid "$USER" -g www-data --exec /usr/bin/env -- $PHP_CGI_ARGS

Notice the “-g www-data” part.

You can always make a variable in case you ever want to edit it.

Restart php_fastcgi and try again. Should work fine now.

Some fast stats: vm1 + nginx, vm1 + lighttpd, vm0 + IIS7one + Apache, vm1 + nginx + PHP and one + Apache + PHP.

These stats should only give a quick overview. To get correct results it should be ran on the same hardware, at the same moment with the same load, and 100% the same pages.

“One” is a Gentoo dual Pentium III with 1.2Gb ram, “vm0” is a Windows 2008 Xen Virtual machine with 1 Gb ram, and has access to two vCPUs (Xeon), “vm1” is a Debian with 128Mb ram, and also access to two vCPUs (Xeon). Nginx wins on static content (followed by Lighttpd). Apache wins by a little over nginx on PHP content in these tests.

Here‘s another site with some stats.


Posted by

in

, , ,

Comments

Leave a Reply…