nginx: php-fastcgi running but php files not executing
- by Daniel
I have recently set up a nginx server with PHP running as FastCGI process. The server is running with HTML files however PHP files are downloading instead of displaying and PHP code is not processed.
This is what I have in nginx.conf:
server {
listen 80;
server_name pubserver;
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
The command netstat -tulpn | grep :9000 displays the following which indicates php-fastcgi is running and listening on port 9000:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2663/php-cgi
If it's if any importance my server is running on CentOS 6 and I installed nginx and PHP using the repositories from The Fedora Project.