我已经在 NGINX 的虚拟机中安装了 CentOS 7。
PHP、MariaDB 和其他一切都已安装并且工作正常。但是,当我访问http://localhost/phpMyAdmin时,它会显示空白页。
有谁知道为什么?
我的 nginx.conf 如下:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
# Upstream to abstract back-end connection(s) for PHP
upstream php {
server unix:/var/run/php-fpm/php-fpm.sock;
}
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#Load virtual hosts enabled
include /etc/nginx/sites-enabled/*.conf;
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name localhost;
root /usr/share/nginx/html;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
}
错误日志
2016/05/27 16:35:58 [error] 12369#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Call to undefined function __() in /usr/share/phpMyAdmin/libraries/core.lib.php on line 245" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /phpMyAdmin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "localhost"
我认为会话文件夹不可被 Web 服务写入尝试更改权限