4

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;
   }
}
3
  • 1
    Have you actually spawned PHP processes? Nginx does not do this for you. Sep 24, 2010 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, 2010 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, 2010 at 3:48

2 Answers 2

1
  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

2
  • 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, 2010 at 4:12
  • Can you, from a shell, connect to 9000? Have you restarted nginx since verifying that?
    – tim
    Sep 24, 2010 at 4:32
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .