phpmyadmin having problems on nginx and php-fpm on RHEL 6

jmlumpkin asked:

We have a web server setup with nginx and php-fpm on RHEL6. This machine already has WordPress installed, and it runs great. We have wordpress set up to go to wptest.domain.local. We then created a new site in sites-enabled called servername.domain.local, where we wanted to host various tools.

PHP works fine throughout, we have no issues with WordPress. But when trying to reach phpmyadmin, we get this error

2012/09/14 16:22:13 [error] 10065#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.15, server: servername, request: "GET /phpmyadmin/setup/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "servername"

And here is our sites config:

    server_name servername severname.domain.local;
    access_log /srv/www/severname/logs/access.log;
    error_log /srv/www/severname/logs/error.log;
    root /srv/www/severname/public_html;

    location / {
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/severname/public_html$fastcgi_script_name;
    }

PHPmyadmin is installed at /srv/www/servername/public_html/phpmyadmin/.

Yesterday I noticed it said there were some SEGFAULT errors too from PHPMyAdmin.

If I put a phpinfo file in this directory, it works fine. The phpinfo included in Phpmyadmin (which has an include, etc) doesn’t work.

The browser displays a ‘502 Bad Gateway’.

Also, usually after a php-fpm restart, I will see a red box saying ‘phpmyadmin -error’, then ‘cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.’. I tried enabling php logging but get nothing.

I do get this in my error log for the site if I go to phpmyadmin/setup

`2012/09/18 08:12:43 [error] 16722#0: *22 FastCGI sent in stderr: “PHP message: PHP Warning: Unknown: open(/var/lib/php/session/sess_5d9vhk4jv1f07v2jsltlnp8tdnp7s167, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0” while reading upstream, client: 192.168.1.11, server: servername, request: “GET /phpmyadmin/setup/ HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “servername”

My answer:


From the latest error you posted, it appears that PHP is trying to write session data to disk in a directory that’s not actually writable, namely /var/lib/php/session.

Check the ownership and permissions on this directory:

ls -ld /var/lib/php/session

Compare these to the user and group ID under which php-fpm is running. These will be found in the user = and group = declarations in PHP-FPM’s pool configuration in /etc/php-fpm.conf or files in the /etc/php-fpm.d/ directory.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.