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.

I have installed Engine X and PHP 5.3.3 from source onto a CentOS 5.5 server. I think everything went well from the installs and Engine X does serve static files OK.

When trying to access a basic php file though, it serves the php code as plain text.


The Engine X error log shows:

2010/09/23 20:49:35 [error] 3331#0: *6 connect() failed (111: Connection refused) while
connecting to upstream, client: my.local.ip, server: the_server,
request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000",
host: "the.servers.ip"



And my configuration file reads:

server {
   listen *:80;

   location ~ \.php$
   {
       fastcgi_pass 127.0.0.1:9000;
       fastcgi_param SCRIPT_FILENAME /var/www/default$fastcgi_script_name;
       fastcgi_param PATH_INFO $fastcgi_script_name;
       include /usr/local/nginx/conf/fastcgi_params;
   }
}
share|improve this question
1  
Have you actually spawned PHP processes? Nginx does not do this for you. –  Martin Fjordvald Sep 24 '10 at 3:02
    
@Martin F - Sounds like that's the problem. Though the fact that nginx would echo PHP source to the client when the FCGI server doesn't respond is kind of troubling. I'm not an nginx guy -- is that expected behavior? –  tim Sep 24 '10 at 3:47
    
I did /etc/init.d/php-fpm start and it appears to be listening on port 9000. Isn't php-fpm what handles starting/managing php processes? –  Nick Sep 24 '10 at 3:48
add comment

2 Answers

  1. Ensure php-fpm is running (ps auxw | grep php or any number of ways)
  2. Ensure php-fpm is actually listening on 9000. (check the configs)
  3. Ensure your software firewall isn't blocking loopback connections on 9000.

I'm not an nginx guy, but the error message is pretty clear: nobody's answering the phone at 127.0.0.1:9000

share|improve this answer
    
I think the error message is from something else. (from earlier) It doesn't show up more times when I reload the page. But it's still returning code to the browser instead of parsing it. "netstat -lpn | grep ":9000"" does show php-fpm listening on 9000. –  Nick Sep 24 '10 at 4:12
    
Can you, from a shell, connect to 9000? Have you restarted nginx since verifying that? –  tim Sep 24 '10 at 4:32
add comment
up vote 0 down vote accepted

Got It! Apparently short tag support is off by default in this version. So NginX was passing it off correctly, but PHP was ignoring the short PHP tags and sending it back un-processed.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.