簡體   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