I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on disp
These hints helped me with my Ubuntu 14.04 LTS install,
In addition I needed to turn on the short_open_tag
in /etc/php5/fpm/php.ini
$ sudo kate /etc/php5/fpm/php.ini
short_open_tag = On
$ sudo service php5-fpm restart
$ sudo service nginx reload
Make sure you've got this in /etc/nginx/fastcgi_params
fastcgi_param SCRIPT_FILENAME $request_filename;
Who knows why this isn't there already? The amount of time this must collectively waste!
This is my vhost for UBUNTU 18.04+apache+php7.2
server {
listen 80;
server_name test.test;
root /var/www/html/{DIR_NAME}/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
The last line makes it different than the other answers.
replace
include fastcgi_params;
with
include fastcgi.conf;
and remove fastcgi_param SCRIPT_FILENAME ... in nginx.conf
Also had this issue and finally found the solution here. In short, you need to add the following line to your nginx fastcgi config file (/etc/nginx/fastcgi_params in Ubuntu 12.04)
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;