调用未定义的函数__()错误 - 使用LNMP的phpMyAdmin

时间:2016-07-26 12:05:34

标签: php mysql nginx phpmyadmin debian

我有phpMyAdmin的问题。当我访问该页面时,它给出了一个白色的空白页面。

这是错误日志

2016/07/26 11:20:16 [error] 2591#2591: *2 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@./url.ph...')
#1 /usr/share/phpmyadmin/libraries/common.inc.php(90): 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: XX.XX.XX.XX, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "XX.XX.XX.XX:8080"

我通过将/var/lib/php/sessions的所有者更改为www-data并将该目录设为可写来跟踪此答案(https://stackoverflow.com/a/21321260)。

enter image description here

但它无济于事,问题仍然存在。

我的LNMP是:

  1. Debian 8(Jessie)64位
  2. PHP7(PHP-FPM)
  3. MariaDB 10.0
  4. Nginx的
  5. 这是我的nginx服务器块:

    server {
        listen 8080;
        server_name localhost;
        root /usr/share/phpmyadmin;
        index index.php index.html index.htm;
    
        access_log /var/log/nginx/phpmyadmin.com.access.log;
        error_log /var/log/nginx/phpmyadmin.com.error.log;
    
        if (!-e $request_filename) {
            rewrite ^/(.+)$ /index.php?url=$1 last;
            break;
        }
        location ~ .php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }   
    

    我应该做什么?

1 个答案:

答案 0 :(得分:4)

从您的日志消息中,似乎缺少mbstring扩展程序:

  

/usr/share/phpmyadmin/libraries/common.inc.php(90):PMA_ warnMissingExtension ('mbstring',true)

由于您使用的是Debian,请使用它来安装扩展程序:

sudo apt-get install php7.0-mbstring