# Lighttpd startet nicht mehr//php-cgi Problem *UPDATE*

## dronin

Hallo,

ich habe ein komisches Problem mit meinem Lighttpd, dieser mag einfach nicht mehr starten, scheinbar ein PHP Problem:

Hier ein paar Angaben:

Calculating dependencies... done!

[ebuild   R   ] www-servers/lighttpd-1.4.23  USE="bzip2 fastcgi gdbm ipv6 memcache mysql pcre php rrdtool ssl webdav -doc -fam -ldap -lua -minimal -test -xattr" 0 kB

```

.-(/etc/lighttpd)-------------------------------------------------------------------------------------(root@fussel)-

`--# /etc/init.d/lighttpd start

 * Starting lighttpd ...                                                                                     [ !! ]

.-(/etc/lighttpd)-------------------------------------------------------------------------------------(root@fussel)-
```

```

###############################################################################

# lighttpd

###############################################################################

var.vhostbase = "/var/www"

var.basedir = var.vhostbase + "/localhost"

var.logdir = "/var/log/lighttpd"

var.statedir = "/var/lib/lighttpd"

var.fcgistartupdir = "/usr/local/bin"

server.modules = (

        "mod_rewrite",

        "mod_redirect",

        "mod_alias",

        "mod_access",

#       "mod_cml",

#       "mod_trigger_b4_dl",

        "mod_auth",

#       "mod_status",

        "mod_setenv",

#       "mod_proxy",

#       "mod_simple_vhost",

#       "mod_evhost",

        "mod_userdir",

        "mod_compress",

        "mod_ssi",

        "mod_usertrack",

#       "mod_expire",

#       "mod_secdownload",

        "mod_rrdtool",

        "mod_webdav",

        "mod_accesslog",

        #"mod_cgi",

        #"mod_fastcgi"

)

include "mime.conf"

server.username = "lighttpd"

server.groupname = "lighttpd"

server.document-root = var.basedir + "/htdocs"

server.pid-file = "/var/run/lighttpd.pid"

server.errorlog = var.logdir + "/error.log"

#server.errorlog-use-syslog = "enable"

server.indexfiles = (

        "index.php", 

        "index.html",

        "index.htm", 

        "default.htm",

        "frontend.php"

)

server.tag = "lighttpd v1.3.37"

server.follow-symlink = "enable"

server.event-handler = "linux-sysepoll"

server.port = 80

server.error-handler-404 = "/error-handler.php"

static-file.exclude-extensions = (

        ".php", 

        ".pl", 

        ".cgi", 

        ".fcgi"

)

accesslog.filename = var.logdir + "/access.log"

dir-listing.activate = "enable"

dir-listing.hide-dotfiles = "enable"

dir-listing.exclude = ("^\.", "~$")

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

userdir.path = "public_html"

userdir.exclude-user = ("root")

ssi.extension = ( ".shtml" )

compress.cache-dir = var.statedir + "/cache/compress"

compress.filetype = ("text/plain", "text/html")

rrdtool.binary  = "/usr/bin/rrdtool"

rrdtool.db-name = var.statedir + "/lighttpd.rrd"

$HTTP["url"] =~ "\.gz$" {

        setenv.add-response-header = ("Content-Encoding" => "x-gzip")

        mimetype.assign = (".gz" => "application/x-gzip")

}

$HTTP["url"] =~ "\.bz2$" {

        setenv.add-response-header = ("Content-Encoding" => "x-bzip2")

        mimetype.assign = (".bz2" => "application/x-bzip2")

}

debug.log-request-header = "enable"

debug.log-response-header = "enable"

debug.log-request-handling = "enable"

debug.log-file-not-found = "enable"

include_shell "cat vhosts/*.conf"

# vim: set ft=conf foldmethod=marker et :

```

```

2009-09-16 18:41:49: (log.c.172) server started

2009-09-16 18:41:49: (mod_fastcgi.c.1087) the fastcgi-backend /usr/bin/php-cgi failed to start:

2009-09-16 18:41:49: (mod_fastcgi.c.1091) child exited with status 127 /usr/bin/php-cgi

2009-09-16 18:41:49: (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-09-16 18:41:49: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed.

2009-09-16 18:41:49: (server.c.928) Configuration of plugins failed. Going down.

```

```

Calculating dependencies... done!

[ebuild R ] dev-lang/php-5.2.10-r1 USE="apache2 berkdb bzip2 cgi cli crypt ctype curl curlwrappers discard-path exif filter force-cgi-redirect ftp gd gdbm gmp iconv imap ipv6 mysql mysqli ncurses nls pcntl pcre pdo pic posix postgres readline reflection session simplexml sockets spl sqlite ssl suhosin threads truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib (-adabas) -bcmath (-birdstep) -calendar -cdb -cjk -concurrentmodphp -db2 -dbase (-dbmaker) -debug -doc (-empress) (-empress-bcs) (-esoob) -fastbuild (-fdftk) (-firebird) -flatfile (-frontbase) -gd-external -hash -inifile -interbase -iodbc (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -oci8 -oci8-instant-client -odbc -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap (-solid) -spell (-sybase) (-sybase-ct) -sysvipc -tidy -tokenizer -wddx -xpm -yaz" 0 kB 

```

Wenn noch Infos gebraucht werden reiche ich die gerne nach.

Moechte nur meinen langsamen Apache echt wieder los werden :)

Vielen Dank im Vorraus fuer Eure HilfeLast edited by dronin on Wed Sep 16, 2009 5:56 pm; edited 2 times in total

----------

## Gibheer

In deiner config ist keine Konfiguration eines vhosts enthaelt und auch die Module simple-vhost oder evhost auskommentiert sind. Es waere auch gut mal die letzten Logeintrage vom lighttpd zu bekommen. In dem dmesg-Ausschnitt konnte ich nix finden, was auf einen Fehler hinweisst.

----------

## dronin

simple oder evhost benoetigt man auch nur wenn man die nutzen moechte, ich finde beide Optionen nicht so toll.

----------

## b3cks

Läuft da vielleicht noch irgendein PHP-Prozess? Ansonsten mal die Config auf Fehler überprüft (Parameter -t)?

----------

## nanos

Hallo!

Wo werden denn bei Dir die mod_cgi und mod_fastcgi includiert?

Machst Du das pro vhost?

----------

## dronin

So sieht einer der VHosts aus:

```
cat 04_fussel_vhost.conf 

$HTTP["host"] =~ "^fussel.ch" {

        url.redirect = ( "^/(.*)" => "https://www.fussel.ch/$1" )

}

        url.rewrite-once = (

        "^/wiki/[sS]kins.*$"  =>      "$0",

        "^/wiki/([^\?]*)$"    =>      "/wiki/index.php?title=$1",

        )       

$HTTP["host"] == "www.fussel.ch" {

        var.localroot = var.vhostbase + "/fussel.ch"

        server.document-root = var.localroot + "/htdocs"

        var.localuid = "5007"

        var.localgid = "5007"

        var.localwrapper = "php-fussel"

        include "modules/mod_fastcgi.conf"

        accesslog.filename = var.localroot + "/var/log/access.log"

}

$SERVER["socket"] == "80.xxx.xxx.xxx:443" {

        var.localroot = var.vhostbase + "/fussel.ch"

        var.localuid = "5007"

        var.localgid = "5007"

        var.localwrapper = "php-fussel"

        include "modules/mod_fastcgi.conf"

        ssl.engine                  = "enable" 

        ssl.pemfile                 = "/etc/lighttpd/ssl/fussel.ch/fussel.ch.pem" 

        ssl.ca-file                 = "/etc/lighttpd/ssl/digital-bit.ch/startssl.ca.crt" 

        server.name                 = "www.fussel.ch"

        server.document-root = var.localroot + "/htdocs"

```

PHP laeuft noch als ModPHP beim Apache, denn den hab ich als Uebergang am laufen.

.-(/etc/lighttpd/vhosts)-----------------------------------------------------------------------------(root@fussel)-

`--# lighttpd -tf /etc/lighttpd/lighttpd.conf

Syntax OK

----------

## Gibheer

kannst du mal bitte noch die modules/mod_fastcgi.conf zeigen? Darauf wird in der Datei verwiesen.

----------

## dronin

```
cat mod_fastcgi.conf 

###############################################################################

# mod_fastcgi

###############################################################################

global { server.modules += ( "mod_fastcgi") }

fastcgi.server = (

        ".php" => ((

"socket" => "/tmp/php-fastcgi.socket",

"bin-path" => "/usr/bin/php-cgi",

"bin-environment" => (

"PHP_FCGI_CHILDREN" => "5",

"PHP_FCGI_MAX_REQUESTS" => "10000" ),

"bin-copy-environment" => (

"PATH", "SHELL", "USER" ),

"broken-scriptfilename" => "enable"

                # socket - this needs to be writable by the webserver itself

                #"socket"               => var.localroot + "/tmp/fcgi.socket",

                # bin-path - the path to the execwrap script -- see NB below

                #"bin-path"             => "/var/www/execwrap/execwrap",

                # check-local - Not 100%, but I'm pretty sure this 

                # disables cheking that the local file exists 

                #"check-local"  => "disable",

                # max-procs - Maximum number of procs to fire up. 

                # I'm pretty stingey here, but my site doesn't see 

                # a lot of traffic.

                #"max-procs"            => 1,

                # bin-environment

                #"bin-environment"      => (

                        # Howman PHP_CFGI_CHILDREN to start up

                #       "PHP_FCGI_CHILDREN"     => "3",

                        # Maximum request (per child? i dunno)

                #       "PHP_FCGI_MAX_REQUESTS" => "1000",

                        # UID - User ID you want the script to execute as

                #       "UID"                   => var.localuid,

                        # GID - Group ID you the script to execute as

                #       "GID"                   => var.localgid,

                        # TARGET - the actual script to run 

                #       "TARGET"                =>  var.vhostbase + "/execwrap/startup/" + var.localwrapper,

                        # CHECK_GID - this just checks the GID of the wrapper script

                #       "CHECK_GID"             => "1"

                #),

                # Copied from another site... not quite sure what it 

                # does other than copying those env to $_ENV

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

                # Fixes broken $_SERVER['PATH_INFO] I believe

                #"broken-scriptfilename" => "enable"

                #"socket" => var.localroot + "/tmp/fcgi.socket",

                #"bin-path" => var.fcgistartupdir + "/" + var.localwrapper,

                #"max-procs" => 5,

                #"max-load-per-proc" => 2,

                #"idle-timeout" => 20,

                #"broken-scriptfilename" => "enable",

                #"bin-environment" => (

                #       "PHP_FCGI_CHILDREN" => "1",

                #       "PHP_FCGI_MAX_REQUESTS" => "100"

                #),

                #"bin-copy-environment" => (

                #       "PATH",

                #       "SHELL",

                #       "USER"

                #)

        ))

)

fastcgi.map-extensions = (

        ".php3" => ".php",

        ".php4" => ".php",

        ".php5" => ".php",

        ".phtml" => ".php",

)

# vim: set ft=conf foldmethod=marker et :

```

Wobei ich mitlerweile wie folgt "ende":

```
2009-09-17 19:46:46: (log.c.172) server started

2009-09-17 19:46:46: (mod_fastcgi.c.1087) the fastcgi-backend /usr/bin/php-cgi failed to start:

2009-09-17 19:46:46: (mod_fastcgi.c.1098) terminated by signal: 11

2009-09-17 19:46:46: (mod_fastcgi.c.1103) to be exact: it segfaulted, crashed, died, ... you get the idea.

2009-09-17 19:46:46: (mod_fastcgi.c.1105) If this is PHP, try removing the bytecode caches for now and try again.

2009-09-17 19:46:46: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed.

2009-09-17 19:46:46: (server.c.928) Configuration of plugins failed. Going down.

```

```
grsec: From 212.123.98.153: exec of /usr/lib64/php5/bin/php-cgi (/usr/bin/php-cgi ) by /usr/sbin/lighttpd[lighttpd:29926] uid/euid:103/103 gid/egid:5005/5005, parent /usr/sbin/lighttpd[lighttpd:29923] uid/euid:103/103 gid/egid:5005/5005

grsec: From 212.123.98.153: exec of /sbin/killall5 (/bin/pidof -x /usr/sbin/lighttpd ) by /sbin/runscript.sh[runscript.sh:29927] uid/euid:0/0 gid/egid:0/0, parent /sbin/runscript.sh[runscript.sh:29924] uid/euid:0/0 gid/egid:0/0

grsec: From 212.123.98.153: exec of /usr/bin/rrdtool (/usr/bin/rrdtool - ) by /usr/sbin/lighttpd[lighttpd:29925] uid/euid:103/103 gid/egid:5005/5005, parent /usr/sbin/lighttpd[lighttpd:29923] uid/euid:103/103 gid/egid:5005/5005

grsec: From 212.123.98.153: exec of /bin/sleep (/bin/sleep 0.1 ) by /sbin/runscript.sh[runscript.sh:29928] uid/euid:0/0 gid/egid:0/0, parent /sbin/runscript.sh[runscript.sh:29915] uid/euid:0/0 gid/egid:0/0

php-cgi[29926]: segfault at 71 ip 00000000007200dc sp 00007667c61ff6b0 error 4 in php-cgi[400000+689000]

grsec: From 212.123.98.153: signal 11 sent to /usr/lib64/php5/bin/php-cgi[php-cgi:29926] uid/euid:103/103 gid/egid:5005/5005, parent /usr/sbin/lighttpd[lighttpd:29923] uid/euid:103/103 gid/egid:5005/5005

```

----------

## Gibheer

Also bei mir sieht die Stelle so aus

```
fastcgi.server = ( ".php" =>

        ( "*" =>

                (

                        "socket" => "/var/run/lighttpd/lighttpd-fastcgi-php-" + PID + ".socket",

                        "bin-path" => "/usr/bin/php-cgi -c /etc/php/cgi-php/php.ini"

                )

        )

)
```

Bei dir geht der Server auf, die Dateiendung wird definiert und dann machst du zwei Klammern auf und ueberspringst damit die Host-Anweisung. Im wiki von lighttpd habe ich auch keinen Eintrag gefunden, der die Hostanweisung raus laesst, also das "*"

----------

## b3cks

Kann ich nicht bestätigen. Bei mir sieht es folgendermaßen aus:

```
# PHP FastCGI

fastcgi.server = ( ".php" =>

                   (

                     ( "socket" => "/tmp/php-fastcgi.socket",

                       "bin-path" => "/usr/bin/php-cgi",

                       "broken-scriptfilename" => "enable",

                       "bin-environment" =>

                         (

                           "PHP_FCGI_CHILDREN" => "5",

                           "PHP_FCGI_MAX_REQUESTS" => "500"

                         ),

                       "bin-copy-environment" =>

                         (

                           "PATH",

                           "SHELL",

                           "USER"

                         ),

                       "max-procs" => 2

                     )

                   )

                 )
```

----------

## dronin

Erklaert leider die komischen segfaults nicht  :Sad:  und ich weiss auch nicht wie ich da mal tiefer dran gehen kann, denn auf dem CLI geht das wunderbar, also stracen ist nicht.

----------

## boris64

Mal so ein Schuss ins Blaue:

Hast du schon eine andere PHP-Version und/oder einen

anderen Kernel ausprobiert? Bei meinem Server gab es diesbezüglich

vor einiger Zeit Probleme unter einem GrSec-Kern.

----------

## dronin

Hi Boris,

zumindest PHP habe ich schon einmal ausgetauscht ja.

Warte momentan auf eine Lauffaehige Version der aktuellen PHP Version, evtl wird es ja dann besser.

Apache macht wie gesagt garkeine Probleme nur der Lighty.

----------

## nanos

Du hast php ohne fastcgi USE Flag kompiliert, ohne das kanns nicht funktionieren.   :Wink: 

----------

## dronin

Problem nur das es dieses UseFlag nicht mehr gibt.

----------

