title: Lighttpd + PHP + FCGI
body: <p>I have a problem with Lighttpd, PHP and CGI. </p>
  
  <p>I use OpenSUSE.10.</p>
  
  <p>I have builded lighttpd (version 1.4.23) and php (version 5.3.0).</p>
  
  <p>This is lighttpd build command lines:</p>
  
  <pre><code>./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
  </code></pre>
  
  <p>This is php build command lines:</p>
  
  <pre><code>./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
  </code></pre>
  
  <p>This is php, php-cgi -v:</p>
  
  <pre><code>gosh@suse:~/Desktop/web_server&gt; /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
  gosh@suse:~/Desktop/web_server&gt; /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
  gosh@suse:~/Desktop/web_server&gt; 
  </code></pre>
  
  <p>This is lighttpd.conf:</p>
  
  <pre><code>server.document-root = "/home/gosh/Desktop/web_server"
  
  server.port = 81
  
  mimetype.assign = (
    ".html" =&gt; "text/html", 
    ".txt" =&gt; "text/plain",
    ".jpg" =&gt; "image/jpeg",
    ".png" =&gt; "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" =&gt; 
                      (( 
                          "bin-path" =&gt; "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini",
                          "socket" =&gt; "php.socket" 
                      )),
                      ".html" =&gt; 
                      (( 
                          "bin-path" =&gt; "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini",
                          "socket" =&gt; "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"
  }
  </code></pre>
  
  <p>This is command line to start lighttpd:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And, finally, lighttpd creates lighttpd_error.log:</p>
  
  <pre><code>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. 
  </code></pre>
  
  <p>My questionis are: </p>
  
  <p>1) has anybody successful experience in launching lighttpd + PHP + FastCGI on Ubuntu or OpenSUSE? </p>
  
  <p>2) why spawning fcgi failed?</p>
  
  <p>I.e. I want to use such index.php to test my web-server:</p>
  
  <pre><code>&lt;? php
  phpinfo();
  ?&gt;
  </code></pre>
  
  <p>P.S.:</p>
  
  <p>If I remove </p>
  
  <pre><code>$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"
  }
  </code></pre>
  
  <p>from lighttpd.conf, lighttpd successfully starts and Firefox displays index.html (but not index.php):</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1251"&gt;
  &lt;title&gt;Yabaaa!!!&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  HELLO!!!
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>Thanks for the responses.</p>
  
  <p>lighttpd_error.log exactly says that there is a problem with FCGI and PHP interpreter. </p>
  
  <p>Yes, backports are available ion SUSE or Ubuntu, but they do NOT work too.</p>
  
  <p>I think it is the OS problem. </p>
  
  <p>I have embedded device:</p>
  
  <pre><code>CPU: AMD AU1000 (MIPS platform, not x86)
  RAM: 64 MB
  HDD: 120 GB
  LAN: ethernet controller
  </code></pre>
  
  <p>Cross compiler to buils apps for this device:</p>
  
  <pre><code>mipsel-linux-gcc
  </code></pre>
  
  <p>So, I have builded Lighttpd and php for MIPS target, copied them to this device and... server started to work normally. I could see index.php from Mozilla!</p>
  
  <p>I do not know why Lighttpd+PHP does not work on PC.</p>
  
  <p>DECISION: I score on the problem.</p>