Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On a development machine (running Ubuntu 11.10, PHP 5.3.6) I have to install PHP 5.2. I compiled nginx and configured it to look for a fcgi process on localhost:9000 for PHP files. The nginx part works: it prints its index.html and if you request index.php tries to connect to the fcgi process but there is nothing running.

Here is how I configure PHP 5.2: --prefix=$dir and --enable-fastcgi: Then I install libfcgi-dev and launch the build: make exits without any error.

Then I try to launch the executable: $dir/bin/php-cgi -b localhost:9000: the process starts (I can see through ps its status: S+) so everything seems ok, except that it does nothing when someone connects to: connection refused. To me, this means that it's not listening at all. Since no error message is printed anywhere, how can I debug this situation and finally get a working FCGI php?

share|improve this question
nginx error_log? php error_log? can you telnet localhost 9000? give a shot on sockets instead of tcp/ip. –  Tabakhase Apr 17 '12 at 0:25
I tried all that: nothing works. Telnet only states connection refused, as a I wrote in my question –  Raffaele Apr 17 '12 at 7:18
Any local firewalls? An iptables not whitelisted the loop interface? If not theres something wrong in your php... run php-cgi -b localhost:9000 in your shell you should be able to connect in a second terminal using telnet localhost 9000 –  Tabakhase Apr 17 '12 at 10:23
Well, I think it's very silly, but it turned out that you must supply a php.ini (for example start with -c /path/to/php.ini) for it to work properly. I didn't specify anything at build time, so maybe it was looking for a php.ini in some default path wich doesn't exist on my machine –  Raffaele Apr 17 '12 at 10:49
@Tabakhase I already tried that. The telnet shell simply could not connect: connection refused. Anyway, it seems that it caches the php.ini settings somewhat, because if I stop the process and then start it again without supplying a php.ini it still works... WTF –  Raffaele Apr 17 '12 at 10:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.