I'm using nginx and php-fpm on many servers. Some have php 5.4 with APC and others 5.5 or 5.6 with opcache. PhpMyAdmin on servers on 5.4 work without any problems. PhpMyAdmin on servers on 5.5 or 5.6 throw 502 errors randomly. All websites hosted on these servers are working well and doesn't throw 502 error.

By randomly I mean that I can reload the same ajax request multiple times and it will fail or success absolutely randomly.

I tested by disabling opcache for phpMyAdmin but it doesn't chaneg anything.

Here are some nginx error logs:

2015/08/09 23:45:12 [error] 8386#8386: *8 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: XX.XX.XX.XX, server: phpmyadmin.host.com, request: "GET /js/get_scripts.js.php?scripts%5B%5D=jquery/jquery.uitablefilter.js&scripts%5B%5D=gis_data_editor.js&scripts%5B%5D=multi_column_sort.js&scripts%5B%5D=makegrid.js&scripts%5B%5D=sql.js&call_done=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "phpmyadmin.host.com", referrer: "https://phpmyadmin.host.com/"
2015/08/09 23:46:04 [error] 8386#8386: *6 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: XX.XX.XX.XX, server: phpmyadmin.host.com, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "phpmyadmin.host.com"

As you can see, even the phpinfo from phpMyAdmin is sometimes gettong on 502

In the PHP FPM log, I got segfaults for each 502 error. Here as one:

[09-Aug-2015 23:46:04] WARNING: [pool www] child 6965 exited on signal 11 (SIGSEGV) after 372.815678 seconds from start
[09-Aug-2015 23:46:04] NOTICE: [pool www] child 9104 started

Finally, the configuration used: nginx site

server {
    listen  443 ssl;
    listen  [::]:443 ssl;
    ssl_certificate /etc/ssl/certs/phpmyadmin.pem;
    ssl_certificate_key /etc/ssl/private/phpmyadmin.key;

    server_name phpmyadmin.host.com;
    root /home/var/www/phpmyadmin/;

    location ~ \.php$ {
            expires off;
            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass  unix:/var/run/php5-fpm.sock;

            fastcgi_buffers 8 16k;
            fastcgi_buffer_size 32k;
            fastcgi_connect_timeout 300;
            fastcgi_send_timeout 300;
            fastcgi_read_timeout 300;
            fastcgi_param PHP_VALUE "max_execution_time=360 \n memory_limit=500M \n post_max_size=40M \n upload_max_filesize=20M \n opcache.enable=0";

    location ~ /\. {
            deny  all;
    access_log /var/log/nginx/phpmyadmin/access.log;
    error_log /var/log/nginx/phpmyadmin/error.log;


pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

phpMyadmin config.inc.php

/* Servers configuration */
$i = 0;

$cfg['blowfish_secret'] = 'a_32_char_long_secret_here';

/* Server: localhost [1] */
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

/* End of servers configuration */

$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['ShowPhpInfo'] = true;

regarding the others php extensions: I'm using debian packages with dotdeb to install them. Extensions included:

  • opcache (but disabled for phpMyadmin host)
  • pdo
  • apcu
  • curl
  • gd
  • imap
  • intl
  • mcrypt
  • mysqli
  • mysql
  • pdo_mysql
  • pdo_pgsql
  • pdo_sqlite
  • pgsql
  • readline
  • sqlite3

Do you have any idea what could cause this problem?

Let me know if you need more informations.

It might not be directly related to phpMyAdmin, but I have this kind of errors ONLY with phpMyAdmin. Servers are used with various PHP projects: Symfony2, magento, custom frameworks, etc...

As far as I can see and after a quick and dirty debugg (echo/exit) I found out that the 502 are coming from the chdir instruction on PMA_response::response function.

Comment it out and the phpinfo page from phpMyAdmin works without any problem. (obviously regular PMA pages doesn't work properly...) I already checked:

  • This is really something that should be addressed to a phpmyadmin-specific support channel. – EEAA Aug 12 '15 at 16:41
  • From the phpMyAdmin support page: Effective September 1st, 2013, support for questions directly related to phpMyAdmin has moved to stackoverflow. All prior support mechanisms have been phased out. Questions about server issues (web server configuration, "404 - Not Found" error, etc), should be asked on serverfault.com. – austinian Aug 12 '15 at 17:36
  • 1
    Did you managed to fix this? I have probably the same problem, I can reproduce it with this simple code: <?php chdir('..'); ?> Don't pay attention on this exact target directory (".."), you can put any directory and it will still segfault randomly. – gseric Aug 17 '15 at 8:21
  • I still have the issue.. – nyro Sep 3 '15 at 7:39
  • When disabling completly opacache on the server, it seems to work correctly without 502 anymore... – nyro Sep 22 '15 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.