Nginx Configuration for PHPMyAdmin - White Page

April 1, 2017 265 views
Nginx PHP Debian

Hi !

Recently I change VPS and i re-install the basic like nginx, php, mysql server. Now I'm blocked about phpmyadmin. I installed it without any troubles but I got a white page.

server {
        listen 80;

        root path/to/phpmyadmin/;
        index index.php index.html index.htm;

        server_name phpmyadmin.mydomainname;

        location / {
                try_files $uri $uri/ =404;

        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock; #I use php7.0 : it's a problem ?
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

And it doesn't work. I try to change my root directory to a simple PHP file.


And it's work. So I don't think there are problems with PHP.

drwxrwxrwx 2 root     4.0K Mar 31 15:39 .
drwxrwxrwx 4 root     4.0K Mar 31 10:21 ..
lrwxrwxrwx 1 www-data   21 Mar 31 15:39 phpmyadmin -> /usr/share/phpmyadmin

Here it's the root directory setting in the config file. As you can see I change the owner of the folder.

I need your help please.


PS: I know there are many topic about it but i didn't find any solution.

2 Answers

Which version of phpMyAdmin are you using, because you have to use a version (not just a security updated version) from within the past year otherwise it won't work with php7

Does the error log give any hints?

tail -20 /var/log/nginx/error.log
  • Oh indeed, there are many errors in the log of nginx.

    2017/04/01 10:22:04 [error] 10722#0: *7 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function __() in /usr/share/phpmyadmin/libraries/core.lib.php:235
    Stack trace:
    #0 /usr/share/phpmyadmin/libraries/core.lib.php(308): PMA_fatalError('The [a@./')
    #1 /usr/share/phpmyadmin/libraries/ PMA_warnMissingExtension('mbstring', true)
    #2 /usr/share/phpmyadmin/index.php(12): require_once('/usr/share/phpm...')
    #3 {main}
      thrown in /usr/share/phpmyadmin/libraries/core.lib.php on line 235" while reading response header from upstream, client:ComputerIP, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "phpmyadmin.mydomainname"

    And about the version of phpMyAdmin i don't know. I didn't find any file with the version.
    But i installed it with this command:

    apt-get install phpmyadmin

    so I think you are right about the source of my problem.
    I will search on internet a version of phpmyadmin for php7.0 (if it exist)

    Thanks for your help.


As an alternative, I would recommend trying Adminer. It's a single file (instead of hundreds) and you're able to simply drop the file anywhere you'd like, giving you the ability to upload it when you need to access your databases from a web-based interface and delete it when you don't need it anymore.

For example, you can download the above PHP file, rename it to dba.php, drop it in the web root, and then visit:

... and you'll be able to login and access your database, much like you would with phpMyAdmin, without the hassle of having to worry about configuration. It just works.

Have another answer? Share your knowledge.