2009-08-30 21 views
3

Lighttpd、PHP、CGIに問題があります。Lighttpd + PHP + FCGI

私はOpenSUSE.10を使用しています。

私はlighttpd(バージョン1.4.23)とphp(バージョン5.3.0)をビルドしました。

これはlighttpdのビルドコマンドラインです:

./configure --prefix=/home/gosh/Desktop/web_server/lighttpd_native_installed --without-zlib --enable-ssl --enable-openssl --with-openssl=/home/gosh/Desktop/web_server/openssl_native_installed --with-openssl-includes=/home/gosh/Desktop/web_server/openssl_native_installed/include --with-openssl-libs=/home/gosh/Desktop/web_server/openssl_native_installed/lib --without-pcre --with-zlib --without-bzip2 

make 
make install 

これはPHPのビルドコマンドラインです:

./configure --prefix=/home/gosh/Desktop/web_server/php_native_installed --without-iconv --disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --enable-fastcgi --enable-force-cgi-redirect 

make 
make install 

これはPHP、PHP-CGIの-v:

[email protected]:~/Desktop/web_server> /home/gosh/Desktop/web_server/php_native_installed/bin/php -v 
PHP 5.3.0 (cli) (built: Aug 30 2009 03:56:22) 
Copyright (c) 1997-2009 The PHP Group 
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies 
[email protected]:~/Desktop/web_server> /home/gosh/Desktop/web_server/php_native_installed/bin/php-cgi -v 
PHP 5.3.0 (cgi-fcgi) (built: Aug 30 2009 03:55:55) 
Copyright (c) 1997-2009 The PHP Group 
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies 
[email protected]:~/Desktop/web_server> 

これをlighttpd.conf:

server.document-root = "/home/gosh/Desktop/web_server" 

server.port = 81 

mimetype.assign = (
    ".html" => "text/html", 
    ".txt" => "text/plain", 
    ".jpg" => "image/jpeg", 
    ".png" => "image/png" 
) 

index-file.names = ("index.php") 

server.modules = (
        "mod_fastcgi", 
        "mod_accesslog" 
       ) 

accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access0.log" 
server.accesslog  = "/home/gosh/Desktop/web_server/lighttpd_access000.log" 

fastcgi.debug = 1 
fastcgi.server = ( 
        ".php" => 
        (( 
         "bin-path" => "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini", 
         "socket" => "php.socket" 
        )), 
        ".html" => 
        (( 
         "bin-path" => "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini", 
         "socket" => "php.socket" 
        )) 
       ) 

$SERVER["socket"] == "127.0.0.1:443" { 
    server.document-root = "/home/gosh/Desktop/web_server" 
    ssl.engine = "enable" 
    ssl.pemfile = "/home/gosh/Desktop/web_server/lighttpd.pem" 

    server.errorlog  = "/home/gosh/Desktop/web_server/lighttpd_error.log" 
    server.accesslog  = "/home/gosh/Desktop/web_server/lighttpd_access1.log" 
    accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log" 
} 

これはlighttpdのを開始するためのコマンドラインです:

sudo /home/gosh/Desktop/web_server/lighttpd_native_installed/sbin/lighttpd -f /home/gosh/Desktop/web_server/lighttpd.conf -m /home/gosh/Desktop/web_server/lighttpd_native_installed/lib 

そして、最終的には、lighttpdのはlighttpd_error.logを作成します。

2009-08-30 04:44:01: (log.c.172) server started 
2009-08-30 04:44:01: (mod_fastcgi.c.1365) --- fastcgi spawning local 
    proc: /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini 
    port: 0 
    socket php.socket 
    min-procs: 4 
    max-procs: 4 
2009-08-30 04:44:01: (mod_fastcgi.c.1390) --- fastcgi spawning 
    port: 0 
    socket php.socket 
    current: 0/4 
2009-08-30 04:44:01: (mod_fastcgi.c.1087) the fastcgi-backend /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini failed to start: 
2009-08-30 04:44:01: (mod_fastcgi.c.1091) child exited with status 2 /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini 
2009-08-30 04:44:01: (mod_fastcgi.c.1094) 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. 
2009-08-30 04:44:01: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed. 
2009-08-30 04:44:01: (server.c.928) Configuration of plugins failed. Going down. 

は私のquestionisは以下のとおりです。

1)誰でも成功した経験を持っていますUbuntuやOpenSUSEでlighttpd + PHP + FastCGIを起動するには?

2)なぜfcgiの作成に失敗しましたか?

I.e.

<? php 
phpinfo(); 
?> 

PS:私は私のウェブサーバをテストするために、このようなのindex.phpを使いたい

私はのlighttpd.confから

$SERVER["socket"] == "127.0.0.1:443" { 
    server.document-root = "/home/gosh/Desktop/web_server" 
    ssl.engine = "enable" 
    ssl.pemfile = "/home/gosh/Desktop/web_server/lighttpd.pem" 

    server.errorlog  = "/home/gosh/Desktop/web_server/lighttpd_error.log" 
    server.accesslog  = "/home/gosh/Desktop/web_server/lighttpd_access1.log" 
    accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log" 
} 

削除する場合は、lighttpdの起動が成功すると、Firefoxは、インデックスを表示.htmlを(ではないのindex.php):

<html> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 
<title>Yabaaa!!!</title> 
</head> 

<body> 
HELLO!!! 
</body> 
</html> 

更新:

ありがとうございます。

lighttpd_error.log FCGIとPHPインタープリタに問題があると正確に言われています。

はい、バックポートはSUSEまたはUbuntuで利用できますが、動作しません。

OSの問題だと思います。

私が埋め込まれているデバイス:このデバイスのbuilsのアプリへ

CPU: AMD AU1000 (MIPS platform, not x86) 
RAM: 64 MB 
HDD: 120 GB 
LAN: ethernet controller 

クロスコンパイラ:だから

mipsel-linux-gcc 

が、私は、MIPSターゲットのLighttpdのとPHPを建てているこのデバイスにそれらをコピーし、 ...サーバーが正常に動作するようになりました。私はMozillaからindex.phpを見ることができました!

Lighttpd + PHPがPCで動作しない理由はわかりません。

決定:私は問題点を挙げています。

+5

はserverfault.comに属します –

答えて

0

ないように注意してください、ほとんどのインストールガイドは、私が

$ SERVERの[ "ソケット"] ==を削除した場合uはあなたの終わりにphp.iniの

cgi.fix_pathinfo = 1 
+0

ありがとうございます。 しかし、あなたが提供するソリューションは、私はすでに絶望的にはこのアドバイスに従っていた (問題が解決しませんでした... これは私のphp.iniだったが: のextension_dir = /ホーム/おやっ/デスクトップ/ WEB_SERVER authorization_state =偽 cgi.fix_pathinfo = 1 – Gosh

1

をこのを追加する必要があることを言います"127.0.0.1:443" server.document-root = "/ home/gosh/Desktop/web_server" ssl.engine = "enable" ssl.pemfile = "/ home/gosh/Desktop/web_server/lighttpd。ペム "

server.errorlog  = "/home/gosh/Desktop/web_server/lighttpd_error.log" 
server.accesslog  = "/home/gosh/Desktop/web_server/lighttpd_access1.log" 
accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log" 

}

のlighttpd.confから、lighttpdの が正常に起動し、Firefoxの ディスプレイは、これがここでの唯一のSSLおよびログファイルについて、別の問題かもしれません

をindex.htmlを。 これらのログファイルは存在しますか? SSL用の鍵ファイルに関する情報はどこですか?

私は、通常、事前ビルドされたパッケージの使用をお勧めします。 SuSEやUbuntuで利用できるバックポートはありませんか?

0

私は、php-cgiバイナリのパス設定が実際のバイナリ名を使用していないことに気が付きました。ubuntu php5-cgiをインストールすると、デフォルトの設定がphp-cgiを指し示すようになりました。 。それは私自身が数分の間推測していました。