我刚刚在 Ubuntu 12.04 上更新了我的 PHP
现在,奇怪的是,我phpinfo.php
在服务器上做了一个简单的操作,然后502错误的网关开始出现。我检查了/etc/nginx/sites-available/default
nginx 配置文件,似乎一切正常:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#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 /usr/share/nginx/html;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
不确定问题是什么,在升级之前我的 PHP 很好。
编辑
刚刚注意到,我进入了目录,/var/run/php5-fpm.sock
但没有看到任何内容php5-fpm.sock
。这是原因吗?
答案1
检查 PHP-FPM 是否正在运行:
ps -ef | grep php
就你的情况来说,它没有运行。请检查它是否已安装:
dpkg -s php5-fpm
在您的案例中,该软件包被标记为“状态:卸载”。造成这种情况的原因是,您从 PPA 升级了 PHP(ppa:ondrej/php5),这导致您的原始副本被删除。您可能必须重新安装任何非核心软件包才能恢复该功能。
要重新添加 php-fpm,您可以运行:
apt-get install php5-fpm
就你的情况而言,这失败了:
php5-fpm : Depends: libsystemd-daemon0 (>= 31) but it is not installable
由于您使用的 PPA 的发布者有另一个 PPA(ppa:ondrej/systemd) 提供此包,安装该包以解决缺少的依赖项,然后重新运行安装。
完成后,验证安装是否成功以及 php-fpm 是否正在运行。