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
Add this in /etc/nginx/conf.d/default.conf
:
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/PATH_TO_YOUR_PHPFPM_SOCKET_FILE/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
Good luck
In case anyone is having this issue but none of the above answers solve their problems, I was having this same issue and had the hardest time tracking it down since my config files were correct, my ngnix and php-fpm jobs were running fine, and there were no errors coming through any error logs.
Dumb mistake but I never checked the Short Open Tag variable in my php.ini file which was set to short_open_tag = Off
. Since my php files were using <?
instead of <?php
, the pages were showing up blank. Short Open Tag should have been set to On
in my case.
Hope this helps someone.
If you getting a blank screen, that may be because of 2 reasons:
Browser blocking the Frames from being displayed. In some browsers the frames are considered as unsafe. To overcome this you can launch the frameless version of phpPgAdmin by
http://-your-domain-name-/intro.php
You have enabled a security feature in Nginx for X-Frame-Options try disabling it.
This solved my issue:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
For reference, I am attaching my location
block for catching files with the .php
extension:
location ~ \.php$ {
include /path/to/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
Double-check the /path/to/fastcgi-params
, and make sure that it is present and readable by the nginx user.