我已经在Ubuntu 16.04机器上安装了Apache php7.0和
mysql,我得到了答案“php没有运行”.这是我的vhost配置:
ServerAdmin webmaster@example.com
ServerName www.example.com
DocumentRoot /var/www/sites/www.example.com/httpdocs
ScriptAlias "cgi-bin" "/var/www/sites/wwww.example.com/cgi-bin"
ErrorLog ${APACHE_LOG_DIR}/www.example.com.error_log
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/www.example.com.log combined
AddHandler php7-fcgi .php
Action php7-fcgi /php7-fcgi virtual
Alias /php7-fcgi-kermit /usr/lib/cgi-bin/php7-fcgi-kermit
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-kermit -socket /run/php/php7.0-fpm.kermit.sock -pass-header Authorization
Require all granted
SetHandler php7-fcgi-kermit
当我尝试访问该网站时,它不是解析PHP而是将其打印到屏幕上.
有人有什么想法吗?
我已经摆脱了以前用于处理apache 2.2的所有其他fpm的东西,并将此行添加到conf中
ProxyPassMatch ^/(.*\.php(/.*)?)$unix:/var/run/php/php7.0-fpm.kermit.sock|fcgi://localhost/var/www/sites/www.example.com/httpdocs
现在我在错误日志中收到以下错误
[Wed Mar 21 13:04:35.539499 2018] [proxy:error] [pid 26569] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /var/run/php/php7.0-fpm.kermit.sock (localhost) failed
对于套接字来说,permisssions看起来是正确的
srw-rw---- 1 kermit kermit 0 Mar 21 13:00 php7.0-fpm.kermit.sock=
我不知道它在哪里得到=但是