简体   繁体   English

无法将lighttpd配置为PHP 7

[英]cannot get lighttpd configured to PHP 7

Apart from logging to the wrong file (the error log defined for that vhost defined last), 除了记录到错误的文件(最后为该虚拟主机定义的错误日志)之外,
lighty does not let me use PHP 7. What am I missing? lighty不允许我使用PHP7。我缺少什么?

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

How can I make sure you're using the FastCGI-enabled version ? 如何make sure you're using the FastCGI-enabled version What else should I look for? 我还要寻找什么?

version info (shrinked to the necessary) 版本信息 (缩小至必要的值)

> 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)

lighty config file excerpt 轻巧的配置文件摘录

> 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"
                 )))

tryouts 试用

If I change the socket to an invalid path, restarting lighttpd works fine; 如果我将套接字更改为无效路径,则重启lighttpd可以正常工作; but the server is unreachable. 但是服务器无法访问。 ( bind failed for: (invalid path) in the error log); bind failed for: (invalid path)错误日志中的bind failed for: (invalid path) ); so this seems like the correct config file. 所以这似乎是正确的配置文件。

Modifying /etc/lighttpd/conf-available/15-fastcgi-php.conf in the same way has no effect at all. 以相同的方式修改/etc/lighttpd/conf-available/15-fastcgi-php.conf根本没有效果。

Changing the socket to "/var/run/php/php7.0-fpm.sock" has no effect either ( php_info() still says PHP 5.6 after restarting lighty). 将套接字更改为"/var/run/php/php7.0-fpm.sock"php_info()重新启动lighty后php_info()仍显示PHP 5.6)。

After changing bin-path to /usr/sbin/php-fpm7.0 , I still get no error when restarting lighttpd, but the web server is unreachable. 将bin-path更改为/usr/sbin/php-fpm7.0 ,重新启动lighttpd时仍然没有错误,但是Web服务器无法访问。

error log excerpt 错误日志摘录

> 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.

update I just uninstalled php5 hoping this would resolve the issues; 更新我刚刚卸载PHP5希望这样就解决了问题; but that didn´t help either. 但这也没有帮助。 Instead, I seem to have no way to get php5 back. 相反,我似乎没有办法找回php5。

Tried a search engine? 尝试过搜索引擎? https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7 https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7

The first hit: https://www.howtoforge.com/tutorial/installing-lighttpd-with-php7-php-fpm-and-mysql-on-ubuntu-16.04-lts/ suggests 第一次点击: 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"
        ))
)

to go along with php.ini cgi.fix_pathinfo=1 与php.ini cgi.fix_pathinfo = 1一起使用

You can follow the instructions on the page above to have Ubuntu run php7.0-fpm as a service, or you can configure lighttpd to start up the fastcgi.server backend by setting "bin-path" in the fastcgi.server definition, but do not do both. 你可以按照上面的页面上的说明有Ubuntu的运行php7.0-FPM作为一种服务,也可以配置的lighttpd通过在fastcgi.server定义设置“仓路径”,以启动fastcgi.server后端, 但两者都不做。

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

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