我有一個新的基於ubuntu/xenial64框的Vagrant安裝。不幸的是,PHP7.0服務沒有運行Vagrant:PHP7.0-fpm.service失敗,因爲控制進程退出,出現錯誤代碼
如果我運行下面的命令systemctl status php7.0-fpm.service
這將是結果:
[email protected]:~$ systemctl status php7.0-fpm.service
* php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2017-01-29 14:37:05 UTC; 16min ago
Process: 2213 ExecStart=/usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf (code=exited, s
Process: 2203 ExecStartPre=/usr/lib/php/php7.0-fpm-checkconf (code=exited, status=0/SUCCESS)
Main PID: 2213 (code=exited, status=78)
Jan 29 14:37:04 Project-Yii-Shop systemd[1]: Stopped The PHP 7.0 FastCGI Process Manager.
Jan 29 14:37:04 Project-Yii-Shop systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Jan 29 14:37:05 Project-Yii-Shop php-fpm7.0[2213]: [29-Jan-2017 14:37:05] ERROR: [pool www] cannot get uid for user 'va
Jan 29 14:37:05 Project-Yii-Shop php-fpm7.0[2213]: [29-Jan-2017 14:37:05] ERROR: FPM initialization failed
Jan 29 14:37:05 Project-Yii-Shop systemd[1]: php7.0-fpm.service: Main process exited, code=exited, status=78/n/a
Jan 29 14:37:05 Project-Yii-Shop systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
Jan 29 14:37:05 Project-Yii-Shop systemd[1]: php7.0-fpm.service: Unit entered failed state.
Jan 29 14:37:05 Project-Yii-Shop systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.
,我試圖啓用此服務,但流浪的Ubuntu索要密碼的主要問題而且,這個Vagrant中的Ubuntu沒有任何密碼。我google了這個問題,但我只看到這個解決方案和上面的一個。
[email protected]roject-Yii-Shop:~$ systemctl enable php-fpm.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ===
Authentication is required to manage system service or unit files.
Authenticating as: Ubuntu (ubuntu)
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to execute operation: Access denied
所以我不知道我應該做的,因爲如果我一個真正的Ubuntu的服務器(而不是在流浪)上安裝PHP7.0我沒有得到這個錯誤。
我用NGINX服務器具有以下配置:
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
try_files $uri =404;
}
我在流浪文件中使用此命令來安裝PHP7.0
apt-get install -y git nginx php7.0-curl php7.0-cli php7.0-intl php7.0-mbstring php7.0-gd php-imagick php7.0-fpm php7.0-mysql php7.0-pgsql php7.0-xml php7.0-zip
而流浪後,這條命令的運行是在達爲了運行php7.0 srevice。
service php7.0-fpm restart
有沒有人看到任何錯誤?
啊哈,你的權利。我查了另一個配置文件,而不是這個www.conf。 我應該從流浪漢中刪除這行'sed -i's/user = www-data/user = vagrant/g'/etc/php/7.0/fpm/pool.d/www.conf'嗎?因爲這設置了用戶。 – stecker
我根本不知道流浪漢,但從OS/php-fpm的角度來看,php-fpm必須與OS上存在的用戶一起運行。因此,要麼添加該用戶,要麼運行php-fpm作爲www-data。 – Bbak