Search code examples
phpnginxfastcgi

nginx not running .php through FastCGI


What am I doing wrong here? My config is as follows:

server {
listen        80;
server_name   internal.lan;

access_log /var/log/nginx/int-access.log;
error_log  /var/log/nginx/int-error.log;
root       /var/www/int;

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}

I've checked that the socket exists at the path in question, but any PHP files just get presented as plain text.

Probably a very simple one as I've never configured PHP with a server besides Apache before; can anyone help? Thanks.


Solution

  • Short tags were the problem.

    <? to <?php fixed this.