无法将 lighttpd 配置为 PHP 7
cannot get lighttpd configured to PHP 7
除了记录到错误的文件(为最后定义的虚拟主机定义的错误日志),
lighty 不让我用 PHP 7. 我错过了什么?
cgi.fix_pathinfo
在 /etc/php/7.0/fpm/php.ini
中启用。
我怎样才能make sure you're using the FastCGI-enabled version
?我还应该寻找什么?
版本信息(缩到需要的)
> lsb_release -a
Description: Ubuntu 16.04.1 LTS
Codename: xenial
> lighttpd -v
lighttpd/1.4.35 (ssl) - a light and fast webserver
Build-Date: Apr 18 2016 15:36:10
> php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
> php-cgi -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cgi-fcgi)
> php-fpm7.0 -v
PHP 7.0.8-0ubuntu0.16.04.3 (fpm-fcgi)
轻巧的配置文件摘录
> head -41 /etc/lighttpd/lighttpd.conf | tail -9
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"broken-scriptfilename" => "enable"
)))
试用
如果我将套接字更改为无效路径,重新启动 lighttpd 工作正常;但服务器无法访问。 (错误日志中的bind failed for: (invalid path)
);所以这似乎是正确的配置文件。
同样修改/etc/lighttpd/conf-available/15-fastcgi-php.conf
完全没有效果
把socket改成"/var/run/php/php7.0-fpm.sock"
也没有效果(重启lighty后php_info()
还是说PHP5.6)。
将 bin-path 更改为 /usr/sbin/php-fpm7.0
后,重启 lighttpd 仍然没有报错,但网络服务器无法访问。
错误日志摘录
> tail /var/log/lighttpd/error.log
(no output)
> tail /var/log/lighttpd/somevhost/error.log
2016-10-10 16:48:02: (log.c.164) server started
2016-10-10 16:48:02: (mod_fastcgi.c.1112) the fastcgi-backend /usr/sbin/php-fpm7-0 failed to start:
2016-10-10 16:48:02: (mod_fastcgi.c.1116) child exited with status 2 /usr/sbin/php-fpm7-0
2016-10-10 16:48:02: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2016-10-10 16:48:02: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed.
2016-10-10 16:48:02: (server.c.1022) Configuration of plugins failed. Going down.
更新
我刚刚卸载了 php5 希望这能解决问题;但这也没有帮助。相反,我似乎没有办法让 php5 回来。
试过搜索引擎吗?
https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7
## Start an FastCGI server for php (needs the php7.0-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php/php7.0-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
配合php.ini cgi.fix_pathinfo=1
您可以按照上面页面的说明将 Ubuntu 运行 php7.0-fpm 作为服务,或者您可以配置 lighttpd 来启动 fastcgi.server 后端通过在 fastcgi.server 定义中设置 "bin-path", 但不要两者都做。
除了记录到错误的文件(为最后定义的虚拟主机定义的错误日志),
lighty 不让我用 PHP 7. 我错过了什么?
cgi.fix_pathinfo
在 /etc/php/7.0/fpm/php.ini
中启用。
我怎样才能make sure you're using the FastCGI-enabled version
?我还应该寻找什么?
版本信息(缩到需要的)
> lsb_release -a
Description: Ubuntu 16.04.1 LTS
Codename: xenial
> lighttpd -v
lighttpd/1.4.35 (ssl) - a light and fast webserver
Build-Date: Apr 18 2016 15:36:10
> php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
> php-cgi -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cgi-fcgi)
> php-fpm7.0 -v
PHP 7.0.8-0ubuntu0.16.04.3 (fpm-fcgi)
轻巧的配置文件摘录
> head -41 /etc/lighttpd/lighttpd.conf | tail -9
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"broken-scriptfilename" => "enable"
)))
试用
如果我将套接字更改为无效路径,重新启动 lighttpd 工作正常;但服务器无法访问。 (错误日志中的bind failed for: (invalid path)
);所以这似乎是正确的配置文件。
同样修改/etc/lighttpd/conf-available/15-fastcgi-php.conf
完全没有效果
把socket改成"/var/run/php/php7.0-fpm.sock"
也没有效果(重启lighty后php_info()
还是说PHP5.6)。
将 bin-path 更改为 /usr/sbin/php-fpm7.0
后,重启 lighttpd 仍然没有报错,但网络服务器无法访问。
错误日志摘录
> tail /var/log/lighttpd/error.log
(no output)
> tail /var/log/lighttpd/somevhost/error.log
2016-10-10 16:48:02: (log.c.164) server started
2016-10-10 16:48:02: (mod_fastcgi.c.1112) the fastcgi-backend /usr/sbin/php-fpm7-0 failed to start:
2016-10-10 16:48:02: (mod_fastcgi.c.1116) child exited with status 2 /usr/sbin/php-fpm7-0
2016-10-10 16:48:02: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2016-10-10 16:48:02: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed.
2016-10-10 16:48:02: (server.c.1022) Configuration of plugins failed. Going down.
更新 我刚刚卸载了 php5 希望这能解决问题;但这也没有帮助。相反,我似乎没有办法让 php5 回来。
试过搜索引擎吗? https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7
## Start an FastCGI server for php (needs the php7.0-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php/php7.0-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
配合php.ini cgi.fix_pathinfo=1
您可以按照上面页面的说明将 Ubuntu 运行 php7.0-fpm 作为服务,或者您可以配置 lighttpd 来启动 fastcgi.server 后端通过在 fastcgi.server 定义中设置 "bin-path", 但不要两者都做。