Want to subscribe to topics you're interested in?
Become a Member

phpmyadmin 500 ERROR Internal server Error

Discussion in 'Add Ons' started by FAPM, Feb 25, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    for server.domain.com do you have domain.com or any other subdomain.domain.com for the same domain with SSL https enabled and any of those have HSTS enabled with include subdomain
    Code:
    add_header Strict-Transport-Security "max-age=0; includeSubdomains;";
    see Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS

    if you do then HSTS is telling the browser to force redirect to HTTPS for all *.domain.com based sites

    check your vhost files also for all references to server.domain.com too to see if you have other vhosts setup with same server.domain.com server_name
    Code:
    grep -Ron 'server.domain.com' /usr/local/nginx/conf/*
     
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Code:
    [[email protected] ~]# grep -Ron 'add_header Strict-Transport-Security "max-age=0; includeSubdomains;' /usr/local/nginx/conf/*
    /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf:30:add_header Strict-Transport-Security "max-age=0; includeSubdomains;
    It is commented.

    Code:
    [[email protected] ~]# grep -Ron 'server.domain.com' /usr/local/nginx/conf/*
    /usr/local/nginx/conf/conf.d/virtual.conf:4:server.domain.com
    /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf:4:server.domain.com
    /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf:21:server.domain.com
    /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf:22:server.domain.com
    /usr/local/nginx/conf/phpmyadmin.conf:2:server.domain.com
    
     
    Last edited: Mar 2, 2016
  3. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    phpmyadmin_ssl.conf:

    Code:
    # https SSL SPDY phpmyadmin
    server {
            listen 443 ssl http2;
                server_name server.domain.com;
                root   html;
    
    keepalive_timeout  3000;
    
    client_body_buffer_size 256k;
    client_body_timeout 3000s;
    client_header_buffer_size 256k;
    ## how long a connection has to complete sending
    ## it's headers for request to be processed
    client_header_timeout  60s;
    client_max_body_size 512m;
    connection_pool_size  512;
    directio  512m;
    ignore_invalid_headers on;
    large_client_header_buffers 8 256k;
    
            ssl_certificate      /usr/local/nginx/conf/ssl/server.domain.com.crt;
            ssl_certificate_key  /usr/local/nginx/conf/ssl/server.domain.com.key;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_session_cache      shared:SSL:10m;
            ssl_session_timeout  10m;
            # mozilla recommended
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
            ssl_prefer_server_ciphers   on;
            #add_header Alternate-Protocol  443:npn-spdy/3;
            #add_header Strict-Transport-Security "max-age=0; includeSubdomains;";
            add_header X-Frame-Options SAMEORIGIN;
            #spdy_headers_comp 5;
            ssl_buffer_size 1400;
            ssl_session_tickets on;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
            access_log              /var/log/nginx/localhost_ssl.access.log     main buffer=32k;
            error_log               /var/log/nginx/localhost_ssl.error.log      error;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
        location / {
            return 302 http://$server_name$request_uri;
        }
       
      include /usr/local/nginx/conf/phpmyadmin_https.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      include /usr/local/nginx/conf/errorpage.conf;
    }
    virtual.conf:

    Code:
    server {
    #         listen   80;
                listen   80 default_server backlog=2048 reuseport;
                server_name server.domain.com;
                root   html;
    
            access_log              /var/log/nginx/localhost.access.log     main buffer=256k flush=5m;
            error_log               /var/log/nginx/localhost.error.log      error;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
    # limit_conn limit_per_ip 16;
    # ssi  on;
    
            location /nginx_status {
            stub_status on;
            access_log   off;
            allow 127.0.0.1;
            #allow youripaddress;
            deny all;
            }
    
                location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
    #         Enables directory listings when index file not found
    #        autoindex  on;
    
    #        Shows file listing times as local time
    #        autoindex_localtime on;
    
    #        Enable for vBulletin usage WITHOUT vbSEO installed
            try_files        $uri $uri/ /index.php;
               
                }
    
            # example nginx-http-concat
            # /csstest/??one.css,two.css
            #location /csstest {
            #concat on;
            #concat_max_files 20;
            #}
    
    include /usr/local/nginx/conf/phpmyadmin.conf;
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
    include /usr/local/nginx/conf/vts_mainserver.conf;
    
           }
    domain.com.conf:

    Code:
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name community.domain.com;
    #            return 301 $scheme://www.community.domain.com$request_uri;
    #       }
    
    server {
     
      server_name community.domain.com www.community.domain.com;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always; 
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/community.domain.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/community.domain.com/log/error.log;
    
      root /home/nginx/domains/community.domain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      #include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      } 
    
      location / {
      #include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      try_files        $uri $uri/ /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
     
  4. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    there's your problem you commented all fastcgi_pass options so nginx can't connect to anything php-fpm wise, both TCP and php-fpm multi pool are disabled from Nginx. Need to enable the TCP single pool for phpmyadmin's php include file php_11495_mysqladmin1199.conf
    Code:
    fastcgi_pass   127.0.0.1:9001;
     
  5. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Where did you find this?

    This is what i am using:

    Code:
    location ~ \.php$ {
      include /usr/local/nginx/conf/503include-only.conf;
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_next_upstream error timeout http_500 http_503;
        fastcgi_pass phpbackend;
        fastcgi_keep_conn on;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
     
  6. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  7. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    ok maybe i did it when testing ....

    But this what i use now:

    Code:
    location ~ \.php$ {
      include /usr/local/nginx/conf/503include-only.conf;
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_next_upstream error timeout http_500 http_503;
        fastcgi_pass phpbackend;
        fastcgi_keep_conn on;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
     
  8. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    fyi for php_11495_mysqladmin1199.conf it should be using unix socket too and not TCP and not multi php-fpm pool

    should be
    Code:
        #fastcgi_pass   127.0.0.1:9001;
        #fastcgi_next_upstream error timeout http_500 http_503;
        #fastcgi_pass phpbackend;
        fastcgi_keep_conn on;
        fastcgi_pass   unix:/tmp/phpfpm_myadmin.sock;
    phpmyadmin is setup to use it's separate unix socket with own username separate from other php-fpm pools as per Addon phpmyadmin.sh - CentminMod.com LEMP Nginx web stack for CentOS
     
  9. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    On this file i have already:

    php_11495_mysqladmin1199.conf:

    Code:
    location ~ \.php$ {
      include /usr/local/nginx/conf/503include-only.conf;
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        ##fastcgi_pass   127.0.0.1:9001;
        fastcgi_next_upstream error timeout http_500 http_503;
        #fastcgi_pass phpbackend;
        fastcgi_keep_conn on;
        fastcgi_pass   unix:/tmp/phpfpm_myadmin.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
     
  10. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    comment out
    Code:
    fastcgi_next_upstream error timeout http_500 http_503;
     
  11. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Ok i did it and restart nginx but nothing :(

    Code:
    ERR_TOO_MANY_REDIRECTS
    Try to do a hard refresh Ctrl+F5 and try on another browser in case of cookies problem and flush dns also....
     
  12. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    might need to use nginx debug mode

    If you have a lot of free disk space, you can enable debug nginx version and compile a nginx debug build of nginx via centmin.sh option NGINX_DEBUG=y centminmod/centmin.sh at 123.08stable · centminmod/centminmod · GitHub

    You can place the option in persistent config /etc/centminmod/custom_config.inc outlined at centminmod.com/upgrade.html#persistent so place in file /etc/centminmod/custom_config.inc
    Code:
    NGINX_DEBUG=y
    then recompile nginx via centmin.sh menu option 4 and then in your nginx error_log directive add debug option A debugging log and restart nginx and check logs

    They will be very very very verbose and lot alot to disk usage logged to error logs, so ensure you have a lot of disk free space.

    You can minimise this by limiting it to specific ip based client connections too
    After debugging is done, reverse the debug now by setting NGINX_DEBUG=n and recompile Nginx again
     
  13. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    If i don't find any other solutions i will but is not a test server and not so easy to do the above :(

    Thanks anyway :)

    I just needed to give access to a user on a second database only and maybe i will found the command that i need to run manually and do it that way and check on another server that i will enable in a day or two just for centminmod tests :)
     
  14. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Is maybe something wrong with the way that i setup it?

    Code:
    cd /usr/local/src/centminmod-123.09beta01/addons
    wget --no-check-certificate https://github.com/centminmod/phpmyadmin/raw/master/phpmyadmin.sh
    chmod 0700 /usr/local/src/centminmod-123.09beta01/addons/phpmyadmin.sh
    ./phpmyadmin.sh install
    Looking for the net for anything related:

    Code:
    https://www.ruby-forum.com/topic/3799445
    https://github.com/phpmyadmin/phpmyadmin/issues/11653
    
    Another user is reporting that this is maybe to caching php sessions on Memcache and this is a change that i did but i am out now and can't test it :(

    I replace also the index with a simple hello word index.php file with correct permissions and then try to load so i will know if it is a server issue and yes didn't load so it's not phpmyadmin issue :)

    I even check the phpmyadmin config file with another one working and they are the same :(
     
    Last edited: Mar 3, 2016
  15. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Ok i enable a new test vps centos 7 1gb ram and yes it has the same issue :(

    Damn can't find any solution for it...... :(
     
  16. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    You can try disabling Zend Opcache within /etc/centminmod/php.d/zendopcache.ini

    found using php --ini the zendopcache.ini file path
    Code:
    php --ini
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File: /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed: /etc/centminmod/php.d/a_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/igbinary.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/mongodb.ini,
    /etc/centminmod/php.d/redis.ini,
    /etc/centminmod/php.d/zendopcache.ini
    contents of /etc/centminmod/php.d/zendopcache.ini - disable comment out zend_extension line with semi-colon ; and restart php-fpm service
    Code:
    ;zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/opcache.so
    ;opcache.error_log=/var/log/php_opcache_error.log
    opcache.enable=1
    opcache.memory_consumption=256
    opcache.interned_strings_buffer=8
    opcache.max_wasted_percentage=5
    opcache.max_accelerated_files=16000
    ; http://php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq
    ; defaults to zend opcache checking every 180 seconds for PHP file changes
    ; set to zero to check every second if you are doing alot of frequent
    ; php file edits/developer work
    ; opcache.revalidate_freq=0
    opcache.revalidate_freq=180
    opcache.fast_shutdown=1
    opcache.enable_cli=0
    opcache.save_comments=1
    opcache.enable_file_override=1
    opcache.validate_timestamps=1
    ;opcache.huge_code_pages=1
    
    To customise own php ini settings use own custom *.ini file PHP-FPM - CentminMod.com LEMP Nginx web stack for CentOS and reference Zend Opcache ini options PHP: Runtime Configuration - Manual
     
  17. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Problem found and solved :)

    The problem is Cloudflare A record for hostname.

    If it is set to pass through Cloudflare (orange cloud icon) it doesn't work but when you disable it and make the cloud icon grey then it works without any modifications :)

    But there is an issue as that exposes the server ip :(

    Can you George make a workaround for it?

    Thanks
     
  18. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    8:35 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    strange that cloudflare would get trapped with 503 and no probs with cloudflare pass through !

    no idea why that is the case as out of box maintenance 503 status is disabled and doesn't trigger usually

    the nginx.conf include has a few other settings to tweak i.e. adding ips to whitelist and bypass 503 maintenance mode or have specific site/urls to bypass 503 maintenance mode

    /usr/local/nginx/conf/maintenance.conf
    Code:
         # IPs you can whitelist from maintenance mode
         geo $maint_whitelist {
              include /usr/local/nginx/conf/sitestatus.conf;
              127.0.0.1 0;
              #YOURIPADDRESS 0;
         }
    
         map $http_host$uri $exclude_url {
              default                                                0;
              "~^newdomain1.com/js/jquery.fittext.js"                1;
              "~^newdomain1.com/blog/js/jquery.fittext.js"           1;
         }
    
         map $maint_whitelist$exclude_url $maintenance {
              default        1;
              10             1;
              11             1;
              00             0;
              01             0;
         }
    but that has nothing to do with cloudflare as default for those 3 maps would be 0, 0 and 00 = 0 so all bypass 503 maintenance mode out of box

    you do have nginx geoip module enabled by default ? or did you disable it ?
     
  19. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    This is not related to 502 !

    I got 502 sometimes browsing some pages and not related with phpmyadmin :)

    This solves the default installation issue with A record enabled to go through Cloudflare:

    Code:
    ERR_TOO_MANY_REDIRECTS
     
    • Informative Informative x 1
  20. pamamolf

    pamamolf Premium Member Premium Member

    3,585
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    12:35 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Hi :)

    Is it possible to edit the script and add an older phpmyadmin version that works on php 5.4 as i have a server that must work in the old version ?

    Any instructions please?

    Thanks