tags:

views:

938

answers:

3

I'm working on setting this up on Mac OS X Leopard. I'm having a devil of a time getting PHP5 working as fastcgi under lighttpd. I've verified that I've compiled php with fastcgi enabled. I've tried configuring lighttpd as I've seen in various documentation.

The core bit that I'm not understanding is if php-cgi is supposed to create the socket, or if lighttpd creates it.

My lighttpd config looks like this:

fastcgi.server = ( ".php" =>
        ( "localhost" =>
                (
                        "socket" => "/var/run/php-fastcgi.socket",
                        "bin-path" => "/usr/local/php/bin/php-cgi"
                )
        )
)

When I check /var/run/ no php-fastcgi.socket has been created.

+1  A: 

The httpd almost certainly creates it, so the fastcgi can inherit it after forking the executable.

Charlie Martin
+1  A: 

Do you have the mod_fastcgi module enabled?

server.modules += ( "mod_fastcgi" )

Does the user the server is running on has permissions to write to /var/run?

For what is worth, here's my config on a machine running Debian Etch:

fastcgi.server = ( ".php" =>
    ((
      "bin-path" => "/usr/bin/php5-cgi",
      "socket" => "/tmp/php.socket",
      "max-procs" => 1,
      "idle-timeout" => 20,

      "bin-environment" => (
        "PHP_FCGI_CHILDREN" => "1",
        "PHP_FCGI_MAX_REQUESTS" => "1000"),

      "bin-copy-environment" => (
        "PATH", "SHELL", "USER"),

      "broken-scriptfilename" => "enable"
     ))
    )
Jorge Gajon
A: 

I was tearing my hair out with the same problem. Ive setup lighty and php so many times on linux, but I struggled to get the php fastcgi-socket working under OSX.

In the end I started the fast cgi server manually, using php-cgi -b 127.0.0.1:5555

Then specified a tcp port in lighty config... fastcgi.server = ( ".php" =>( "localhost" =>("host" => "127.0.0.1","port" => 5555 )))

Probably not ideal, but it does work this way

carpii