WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: lighttpd, php5, mysql fastcgi problem  (Read 11519 times)

Offline blu

  • Newbie
  • *
  • Posts: 6
lighttpd, php5, mysql fastcgi problem
« on: February 01, 2010, 04:26:37 AM »
I've installed lighttpd and php5 and modified the lighthttpd.conf to
Code: [Select]
server.document-root = "/htdocs"
server.port = 80
server.username = "tc"
server.groupname = "nogroup"
server.chroot = "/www"

server.modules              = (
            "mod_access",
            "mod_accesslog",
    "mod_fastcgi",
            "mod_rewrite",
    "mod_auth"
)

fastcgi.server = (
  ".php" =>
  (( "host" => "127.0.0.1",
     "port" => 1026,
      "bin-path" => "/usr/local/bin/php-cgi"
  )))
When I run lighttpd I get
Code: [Select]
2010-02-01 14:20:35: (log.c.172) server started
2010-02-01 14:20:35: (mod_fastcgi.c.1087) the fastcgi-backend /usr/local/bin/php-cgi failed to start:
2010-02-01 14:20:35: (mod_fastcgi.c.1091) child exited with status 2 /usr/local/bin/php-cgi
2010-02-01 14:20:35: (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.
2010-02-01 14:20:35: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed.
2010-02-01 14:20:35: (server.c.928) Configuration of plugins failed. Going down.

If i change the lighttpd.conf to
Code: [Select]
fastcgi.server = (
  ".php" =>
  (( "bin-path" => "/usr/local/bin/php-cgi",
      "socket" => "/tmp/php.socket"
  )))
I get
Code: [Select]
2010-02-01 14:24:58: (log.c.172) server started
2010-02-01 14:24:58: (mod_fastcgi.c.960) bind failed for: unix:/tmp/php.socket-0 No such file or directory
2010-02-01 14:24:58: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed.
2010-02-01 14:24:58: (server.c.928) Configuration of plugins failed. Going down.

Any help is appreciated. Thanks.

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: lighttpd, php5, mysql fastcgi problem
« Reply #1 on: February 01, 2010, 02:45:37 PM »
Maybe support was not built in:
Quote
If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
« Last Edit: February 01, 2010, 02:47:09 PM by ^thehatsrule^ »

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: lighttpd, php5, mysql fastcgi problem
« Reply #2 on: February 02, 2010, 07:46:47 AM »
FCGI is enabled, I use it everyday. The http/php server needs to be started as root (or sudo) since the user doesn't have access to the socket device.
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline blu

  • Newbie
  • *
  • Posts: 6
Re: lighttpd, php5, mysql fastcgi problem
« Reply #3 on: February 02, 2010, 07:49:11 AM »
are you using lighttpd or apache2?

can you post some lines from lighttpd.conf? How do you start the server? I mean what do you type on terminal.

Thanks.
« Last Edit: February 02, 2010, 07:50:55 AM by blu »

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: lighttpd, php5, mysql fastcgi problem
« Reply #4 on: February 02, 2010, 09:35:04 AM »
Here is a config file for lighttpd that works:
Code: [Select]
server.modules              = (
                                "mod_rewrite",
                                "mod_redirect",
                                "mod_alias",
                                "mod_access",
                                "mod_auth",
                                "mod_setenv",
                                "mod_fastcgi",
                                "mod_cgi",
                                "mod_accesslog" )

server.document-root        = "/home/htdocs/"

server.errorlog             = "/dev/null"

index-file.names            = ( "index.php", "index.html",
                                "index.htm", "default.htm" )

mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jar"          =>      "application/x-java-archive",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar",
  ""              =>      "application/octet-stream",
 )

$SERVER["socket"] == ":80" {
fastcgi.server             = ( ".php" => ((
                                   "bin-path" => "/usr/local/bin/php-cgi",
                                   "socket" => "/tmp/php.socket"
                               ))
                            )
fastcgi.map-extensions = ( ".html" => ".php" )
}

accesslog.filename          = "/dev/null"

url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

I use the command `sudo lighttpd -f /path/to/config/file`
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10965
Re: lighttpd, php5, mysql fastcgi problem
« Reply #5 on: February 02, 2010, 09:47:47 AM »
Why map html to php? If I understand that correctly, it increases server load by having PHP process things it does nothing to.
The only barriers that can stop you are the ones you create yourself.

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: lighttpd, php5, mysql fastcgi problem
« Reply #6 on: February 02, 2010, 09:57:51 AM »
this config file is for a server that only uses html files with php, so it is easier to have everything be handled by the php server since everything needs to anyway.

This config file is just a sample to change and/or build upon.
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline blu

  • Newbie
  • *
  • Posts: 6
Re: lighttpd, php5, mysql fastcgi problem
« Reply #7 on: February 02, 2010, 10:42:39 AM »
It works! Thank you very much. I think I'm going to try this on a 486 :).