David Chalifoux
David Chalifoux

Reputation: 128

White Page After Installing PHP NGINX

I've looked into around 25 different tutorials and threads on this issue and how installation should go, yet I am still getting this error.

Whenever I visit a PHP page after installing php5-fpm to sit alongside NGINX, it renders a white page with no error messages, also note that in /var/log/NGINX, the log is empty.

My virtual host's config looks like this:

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors on;
    include /etc/nginx/fastcgi_params;
}

And my www.conf is using the following parameters besides the defaults:

listen = /var/run/php5-fpm.sock

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

user = www-data
group = www-data

Any help appreciated! I've also tried using the TCP port instead of the socket, and I already checked the location of the "fastcgi_params" file and it's where it should be.

Upvotes: 1

Views: 1776

Answers (2)

pespantelis
pespantelis

Reputation: 15372

Location in my config:

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    include fastcgi_params;
}

I had the same issue, until I added this: fastcgi_param SCRIPT_FILENAME $request_filename;

Upvotes: 3

whitwhoa
whitwhoa

Reputation: 2489

Hopefully these will help. They are my current configuration settings that I am running on my development server for nginx/php-fpm. If this does not help you might try posting something on serverfault:

www.conf

[www]

user = www-data
group = www-data

listen = /var/run/php5-fpm.sock

listen.owner = www-data
listen.group = www-data

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

chdir = /

php-fpm.conf

[global]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
include=/etc/php5/fpm/pool.d/*.conf

virtual host config

server {

    listen 80;

    root /sites/jason/site.com/public;

    index index.php index.html index.htm;

    server_name jason.site.com;

    # Catch all
    error_page 404 /index.php;

    location ~ \.php$
    {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /sites/jason/jason.site.com$fastcgi_script_name;
        fastcgi_param SITE_URL jason.site.com;
        fastcgi_param SITE_DIR /sites/jason/jason.site.com;
        include fastcgi_params;
    }

}

And always remember to restart nginx and php-fpm after making changes to the files:

service nginx restart
service php5-fpm restart

Upvotes: 0

Related Questions