PDA

View Full Version : Problems getting lighttpd working with php and fcgi


pormogo
06-05-2008, 01:58 AM
Below is a post I posted recently on the old apparently dying freebsd forums. I thank everyone over there for letting me know that place was dead and that this was the new preferred hangout. I really like the look of this place :)

I've been using the guide over at nixcraft to install php and lighttpd

http://www.cyberciti.biz/faq/howto-...cgi-php-server/

Everything compiles and installs as expected but I get an error after I uncomment the fcgi section in lighttpd.conf

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)


I think the bold line is the issue as there is no socket in the location that it is referring to. Unfortunately I have no idea how to create the socket. Below is the output from the php-cgi -v command if that is any help at all.

root@weltall:/usr/ports# php-cgi -v
PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: May 24 2008 17:25:53)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies


Thanks in advance for any help.

Carpetsmoker
06-05-2008, 12:04 PM
What error are you getting?

Check if the lighttpd user is allowed to write to /var/run/lighttpd, or you can try using something like /tmp/php-fastcgi.socket

Nightweaver
06-05-2008, 12:12 PM
Try this:

fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/local/bin/php-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 2,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
)))

Works just fine for me.;)

pormogo
06-06-2008, 11:02 PM
Yeah setting the path into temp fixed the issue. I was a little confused as to if the socket was supposed to exist at install time or if it was being created when the server was being started. Apparently it's the latter. Everything seems to be working just fine now [face_thumbsup]