doulai2025 2016-10-10 14:50
浏览 171
已采纳

无法将lighttpd配置为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?

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

How can I 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; but the server is unreachable. (bind failed for: (invalid path) in the error log); 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.

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

After changing bin-path to /usr/sbin/php-fpm7.0 , I still get no error when restarting lighttpd, but the web server is unreachable.

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; but that didn´t help either. Instead, I seem to have no way to get php5 back.

  • 写回答

1条回答 默认 最新

  • download201401 2016-10-11 11:32
    关注

    Tried a search engine? 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

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

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Linux环境下CA证书更新问题
  • ¥15 sqlserver语句提取结果以外数据
  • ¥60 微信小程序如何上传QQ聊天文件
  • ¥300 开发的系统遭到无良商家的破解,请问如何防止再次发生,并追回损失
  • ¥15 java代码写在记事本上后在cmd上运行时无报错但又没生成文件
  • ¥15 关于#python#的问题:在跑ldsc数据整理的时候一直抱这种错误,要么--out识别不了参数,要么--merge-alleles识别不了参数(操作系统-linux)
  • ¥15 PPOCRLabel
  • ¥15 混合键合键合机对准标识
  • ¥100 现在不懂的是如何将当前的相机中的照片,作为纹理贴图,映射到扫描出的模型上
  • ¥15 魔霸ROG7 pro,win11.息屏后会显示黑屏,如图,如何解决?(关键词-重新启动)