0

Hey guys, I can't figure this out, when I add the fastcgi module to lighttpd when I try to connect to a php page, I get a segmentation fault error. Nothing is in the error log, and nothing else is printed on the crash. It seems to only be a problem with php pages; if I connect to an html page, while the fastcgi module is on, the server doesn't crash. Also, I get a Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error. when I connect to a php page.

The conf files.

lighttpd.conf

var.log_root    = "/var/log/lighttpd"
var.server_root = "/var/www"
var.state_dir   = "/var/run"
var.home_dir    = "/var/lib/lighttpd"
var.conf_dir    = "/etc/lighttpd"

var.vhosts_dir  = server_root + "/vhosts"

var.cache_dir   = "/var/cache/lighttpd"

var.socket_dir  = home_dir + "/sockets"

include "modules.conf"

server.port = 80

server.username  = "lighttpd"
server.groupname = "lighttpd"

server.pid-file = state_dir + "/lighttpd.pid"

server.errorlog = log_root + "/error.log"

include "conf.d/access_log.conf"

include "conf.d/debug.conf"

server.event-handler = "poll"

server.network-backend = "linux-sendfile"

server.max-fds = 2048

server.stat-cache-engine = "simple"

server.max-connections = 150

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

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

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

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

include "conf.d/mime.conf"

include "conf.d/dirlisting.conf"

server.follow-symlink = "enable"

server.upload-dirs = ( "/var/tmp" )

modules.conf

server.modules = (
  "mod_access",
  #"mod_fastcgi" #Not needed, referenced in /conf.d/fastcgi.conf
)
include "conf.d/fastcgi.conf"

conf.d/fastcgi.conf

server.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" => (( 
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php-fastcgi.socket" 
                   ))
                 )

Thanks, Max

Ben
  • 380
  • 1
  • 6
  • 15
  • If you run /usr/bin/php-cgi by hand, does it segfault? Also, is that the actual binary, or a script that sets up the environment variables for fastcgi then runs the actual binary? – DerfK Mar 13 '11 at 02:02
  • @DerfK How would I request it to process a php script? (lighttpd only seg faults on a php request). And the file looks like a binary (cat returned a lot of random info, and the file is 3 MB) – Ben Mar 13 '11 at 02:13
  • @mazzzzz `/usr/bin/php-cgi /some/php/script.php` you'll need to hit enter a couple of times since it will expect you to type in headers and stuff. – DerfK Mar 13 '11 at 13:28
  • It worked correctly, outputted some headers (powered by, content type), then ran the echo command correctly. Also, same error when root. – Ben Mar 13 '11 at 17:54
  • @mazzzzz OK, which distribution is this and did you get php and lighttpd and lighttpd's mod_fastcgi all from the same repository? – DerfK Mar 13 '11 at 18:41
  • Alright, it's amazon's ec2 32 bit custom distro, "Amazon Linux AMI release 2010.11.1 (beta)". I got everything through the yum command (so I assume the same repository). The only problem I can think of is that I tried to install lighttpd from source (it didn't install correctly); I didn't uninstall it (mainly because I don't know how :/). Then I installed from yum. – Ben Mar 13 '11 at 20:10

1 Answers1

0

Based on your comments, you have probably ended up mixing the mod_fastcgi.so from your custom install with the lighttpd version installed from the repository. Since the versions don't match, it crashes when you attempt to use it. Ideally, you'd uninstall the previous lighttpd attempt completely, but for now, run find / -name mod_fastcgi.so and remove everything it finds. Then, reinstall the lighttpd-fastcgi package to install the files that really should be there, with the correct version.

DerfK
  • 19,313
  • 2
  • 35
  • 51