繁体   English   中英

无法将lighttpd配置为PHP 7

[英]cannot get lighttpd configured to PHP 7

除了记录到错误的文件(最后为该虚拟主机定义的错误日志)之外,
lighty不允许我使用PHP7。我缺少什么?

/etc/php/7.0/fpm/php.ini启用了cgi.fix_pathinfo

如何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)错误日志中的bind failed for: (invalid path) ); 所以这似乎是正确的配置文件。

以相同的方式修改/etc/lighttpd/conf-available/15-fastcgi-php.conf根本没有效果。

将套接字更改为"/var/run/php/php7.0-fpm.sock"php_info()重新启动lighty后php_info()仍显示PHP 5.6)。

将bin-path更改为/usr/sbin/php-fpm7.0 ,重新启动lighttpd时仍然没有错误,但是Web服务器无法访问。

错误日志摘录

> 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

第一次点击: https : //www.howtoforge.com/tutorial/installing-lighttpd-with-php7-php-fpm-and-mysql-on-ubuntu-16.04-lts/建议

## 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后端, 但两者都不做。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM