7340 lighttpd's mod_fastcgi won't execute .php files

Michael999

Neuer User
Mitglied seit
24 Dez 2008
Beiträge
65
Punkte für Reaktionen
0
Punkte
0
Lighttpd reads e.g. html files fine, but it won't execute .php files. Anytime I try to execute a .php file the following error is given in the log:

--------------
2011-04-24 13:32:19: (log.c.166) server started
2011-04-24 13:32:52: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-2
2011-04-24 13:32:52: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2011-04-24 13:32:52: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-1
2011-04-24 13:32:52: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 1 load: 1
2011-04-24 13:32:52: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-0
2011-04-24 13:32:52: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 2 load: 1
2011-04-24 13:32:54: (mod_fastcgi.c.2785) fcgi-server re-enabled: 0 /var/run/lighttpd/php-fastcgi.socket
2011-04-24 13:32:54: (mod_fastcgi.c.2785) fcgi-server re-enabled: 0 /var/run/lighttpd/php-fastcgi.socket
2011-04-24 13:32:54: (mod_fastcgi.c.2785) fcgi-server re-enabled: 0 /var/run/lighttpd/php-fastcgi.socket
--------------

/var/run/lighttpd/php-fastcgi.socket-0 (+1,2) do exist. Just to make sure it wasn't a permission thing I did a "chown -R wwwrun:wwwrun" on /var/run/lighttpd and, because wwwrun runs lighttpd. I also did a chmod -R 777 on /var/run/lighttpd. This made no diference though, as the same errors are given in the log. What's the cause of this?

Also, I'd like to add that when I try to compile lighttpd with the module "enable locks in mod_webdav" it fails to compile and gives this error:

--------------
cp: cannot stat `source/target-mips_uClibc-0.9.29/lighttpd-1.4.28/src/.libs/mod_webdav.so': No such file or directory
/home/x/freetz-trunk-7340/toolchain/build/mips_gcc-4.4.6_uClibc-0.9.29/mips-linux-uclibc/bin/mips-linux-uclibc-strip: 'packages/target-mips_uClibc-0.9.29/lighttpd-1.4.28/root/usr/lib/lighttpd/mod_webdav.so': No such file
make: *** [packages/target-mips_uClibc-0.9.29/lighttpd-1.4.28/root/usr/lib/lighttpd/mod_webdav.so] Error 1
--------------
 
Perhaps you can try to do a console login with user wwwrun. Go to /var/run/lighttpd and try to create a file?

Regards
Oliver

edit: [mod_webdav] Please have a look into ...lighttpd-1.4.28/config.log and search for mod_webdav?
 
Zuletzt bearbeitet:
I tried to login with "wwwrun" from the console using no password and wwwrun as password, but it just says "login incorrect". This corresponds with "cat /etc/passwd" which says:

Code:
wwwrun:x:1001:4:lighttpd account:/home/wwwrun:/bin/false

which shows user wwwrun has no shell access. Or am I doing something wrong here?


On mod_webdav, "mod_webdav" occurs twice in lighttpd-1.4.28/config.log :

configure:13722: checking for properties in mod_webdav
configure:13732: result: yes

......

configure:13930: checking for locks in mod_webdav
configure:13940: result: yes
 
I tried out lighttpd and it works for me (but I don't own a 7340):
Code:
root@fritz:/var/run# ls -l /var/run/*light*
-rw-r--r--    1 root     root             6 Apr 26 15:18 /var/run/lighttpd.pid

/var/run/lighttpd:
srwxr-xr-x    1 wwwrun   wwwrun           0 Apr 26 15:18 php-fastcgi.socket-0
srwxr-xr-x    1 wwwrun   wwwrun           0 Apr 26 15:18 php-fastcgi.socket-1
srwxr-xr-x    1 wwwrun   wwwrun           0 Apr 26 15:18 php-fastcgi.socket-2

root@fritz:/var/run# ps | egrep -e "light|php" |grep -v grep
28716 wwwrun    2232 S    lighttpd -f /mod/etc/lighttpd/lighttpd.conf
28717 wwwrun    6896 S    /usr/bin/php-cgi
28719 wwwrun    6896 S    /usr/bin/php-cgi
28723 wwwrun    6896 S    /usr/bin/php-cgi
28724 wwwrun    6896 S    /usr/bin/php-cgi
28725 wwwrun    6900 S    /usr/bin/php-cgi
28726 wwwrun    6904 S    /usr/bin/php-cgi
root@fritz:/var/run#
And mod_webdav is built, too.

Regards
Oliver

edit:
Code:
wwwrun:x:1000:1004:lighttpd account:/home/wwwrun:/bin/false
Why is your gid so low?
 
Thank you for answering olistudent :).

I tried all kinds of things, like changing the socket path, recreating user wwwrun, playing with php's memory settings (I read somewhere those are relevant to socket errors), but I can't get it to work.

The strange thing is, when I first posted the socket files were created in "/var/run/lighttpd", even though I still got those "permission denied" errors in the log and "503 - Service Not Available" / "500 - Internal Server Error" in the browser. Now however they're not created at all when loading .php files.

Code:
root@fritz:/var/run# ls -l /var/run/*light*
-rw-r--r--    1 root     root             6 Apr 26 16:05 /var/run/lighttpd.pid

/var/run/lighttpd:

php-cgi processes are started:

Code:
root@fritz:/var/run# ps | egrep -e "light|php" |grep -v grep
18288 wwwrun    4272 S    lighttpd -f /mod/etc/lighttpd/lighttpd.conf
18289 wwwrun    9276 S    /usr/bin/php-cgi
18297 wwwrun    9276 S    /usr/bin/php-cgi
18298 wwwrun    9276 S    /usr/bin/php-cgi
18308 wwwrun    9276 S    /usr/bin/php-cgi
18309 wwwrun    9276 S    /usr/bin/php-cgi
18314 wwwrun    9276 S    /usr/bin/php-cgi

Manually creating them didn't work either:

root@fritz:/var/run# touch /var/run/lighttpd/php-fastcgi.socket-0
root@fritz:/var/run# touch /var/run/lighttpd/php-fastcgi.socket-1
root@fritz:/var/run# touch /var/run/lighttpd/php-fastcgi.socket-2
root@fritz:/var/run# chmod -R 777 /var/run/lighttpd
root@fritz:/var/run# chown -R wwwrun:wwwrun /var/run/lighttpd
root@fritz:/var/run# lighttpd -f /mod/etc/lighttpd/lighttpd.conf

lighttpd error log after trying to load .php file:

Code:
2011-04-26 14:27:32: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-2 
2011-04-26 14:27:32: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-04-26 14:27:32: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-1 
2011-04-26 14:27:32: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 1 load: 1 
2011-04-26 14:27:32: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-0 
2011-04-26 14:27:32: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 2 load: 1 
2011-04-26 14:27:34: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket 
2011-04-26 14:27:34: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket 
2011-04-26 14:27:34: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket

I'm not sure what else to try. This is the fastcgi part of lighttpd.conf:

Code:
server.modules += ( "mod_fastcgi" )
fastcgi.server = (
        ".php" => (( "socket" => "/var/run/lighttpd/php-fastcgi.socket", "bin-path" => "/usr/bin/php-cgi", "max-procs" => 3 ))
)


mod_webdav still won't compile. I'll try a fresh trunk, maybe that'll help with this.

Should the GID be higher?

Code:
root@fritz:/var/run# cat /etc/group
root:x:0:
users:x:1:
nobody:x:2:
openvpn:x:3:
wwwrun:x:4:
sshd:x:1000:
ftpsec:x:1002:
web:x:1004:
 
Zuletzt bearbeitet:
What are the permissions of your /var/run/lighttpd?
Code:
# ls -l |grep light
drwx------    2 wwwrun   wwwrun           0 Apr 26 15:18 lighttpd
-rw-r--r--    1 root     root             6 Apr 26 15:18 lighttpd.pid
# ls -l /var |grep run
drwxr-xr-x    6 root     root             0 Apr 26 16:38 run

GID: I wondered because mine seem to start at 1000. But that should only be cosmetic.
 
Code:
root@fritz:/var/run# ls -l |grep light
drwxrwxrwx    2 wwwrun   wwwrun         100 Apr 26 16:24 lighttpd
-rw-r--r--    1 root     root             6 Apr 26 16:27 lighttpd.pid

Edit: by using a fresh trunk, mod_webdav is built. Still have the same lighttpd/fastcgi problem though.
 
Zuletzt bearbeitet:
Perhaps you can attach strace to your lighttpd and post a log. But I think there have to be some permissions wrong on the way to /var/run/lighttpd...

Regards
Oliver
 
I attached an strace log of lighttpd when trying to load a .php file. You appear to be right, it seems to be a permission problem, but what's the solution?

Anhang anzeigen strace-lighttpd.txt
 
Please post the permissions of /var, /var/run and /var/run/lighttpd. Something has to be different compared to other (my) firmwares.

Regards
Oliver
 
Permissions of /var:

Code:
root@fritz:/var/mod/root# ls -l /var
lrwxrwxrwx    1 root     root            19 Apr 26 19:38 TZ -> /etc/default.031/TZ
-rw-r--r--    1 root     root             1 Jan  1  2000 USB-proc-bus-usb-001-001-hub
-rw-r--r--    1 root     root             4 Jan  1  2000 USB-proc-bus-usb-001-002-storage
-rw-r--r--    1 root     root             1 Jan  1  2000 USB-proc-bus-usb-002-001-hub
drwxr-xr-x    3 root     root            60 Jan  1  2000 cache
-rw-r--r--    1 root     root          5653 Jan  1  2000 config.def
drwxr-xr-x    2 root     root            40 Jan  1  2000 db
lrwxrwxrwx    1 root     root            27 Jan  1  2000 default -> /etc/default.Fritz_Box_7340
drwxr-xr-x    2 root     root            80 Jan  1  2000 dev
-rw-r--r--    1 root     root          1430 Jan  1  2000 devices
drwxr-xr-x    2 root     root           120 Jan  1  2000 dsl
-rw-r--r--    1 root     root          1050 Apr 26 19:38 env
-rw-r--r--    1 root     root          6322 Jan  1  2000 env.cache
drwxr-xr-x    2 root     root           780 Apr 26 19:38 flash
lrwxrwxrwx    1 root     root            31 Jan  1  2000 flash.html -> /var/html/html/tools/flash.html
lrwxrwxrwx    1 root     root            31 Jan  1  2000 fx_moh -> /etc/default.031/fx_moh.default
drwxr-xr-x    2 root     root            40 Jan  1  2000 gcov
lrwxrwxrwx    1 root     root            13 Jan  1  2000 html -> /usr/www/avme
lrwxrwxrwx    1 root     root            17 Jan  1  2000 html.nas -> /usr/www.nas/avme
lrwxrwxrwx    1 root     root            19 Apr 26 19:38 htmltext.db -> /etc/htmltext_en.db
-rw-r--r--    1 root     root           355 Jan  1  2000 jason_boxinfo.xml
drwxr-xr-x    2 root     root            60 Apr 26 19:37 lib
drwxr-xr-x    2 root     root            40 Apr 26 19:25 lock
drwxr-xr-x    2 root     root           140 Jan  1  2000 log
drwxr-xr-x    3 root     root           100 Jan  1  2000 media
drwxr-xr-x   11 root     root           220 Jan  1  2000 mod
-rwxrwxrwx    1 root     root          8476 Apr 26 19:25 post_install
drwxr-xr-x    2 root     root            80 Jan  1  2000 rpc
drwxr-xr-x    7 root     root           540 Apr 26 19:37 run
drwxr-xr-x    3 root     root            60 Jan  1  2000 spool
lrwxrwxrwx    1 root     root             6 Jan  1  2000 sysfs -> ../sys
drwxr-xr-x    2 root     root            80 Jan  1  2000 tam
drwxrwxrwt    8 root     root          1100 Apr 26 19:31 tmp
-rw-r--r--    1 root     root             0 Jan  1  2000 usbhostup
-rw-r--r--    1 root     root            50 Jan  1  2000 users.acl
-rw-r--r--    1 root     root            21 Jan  1  2000 users.map
-rw-r--r--    1 root     root           974 Jan  1  2000 wan.tc
-rw-r--r--    1 root     root           790 Jan  1  2000 websrv_ssl_cert.pem

/var/run:

Code:
root@fritz:/var/mod/root# ls -l /var/run
drwxr-xr-x    3 root     root           120 Jan  1  2000 callmonitor
-rw-r--r--    1 root     root             4 Jan  1  2000 ctlmgr.pid
drwxr-xr-x    2 nobody   nobody          60 Jan  1  2000 dnsmasq
-rw-r--r--    1 root     root             5 Jan  1  2000 dropbear.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 dsld.pid
-rw-r--r--    1 root     root             0 Jan  1  2000 dsld.run
drwxr-xr-x    2 root     root            60 Jan  1  2000 hostapd
-rw-r--r--    1 root     root             5 Jan  1  2000 inetd.pid
-rw-r--r--    1 root     root             5 Apr 26 20:08 lighttpd.pid
-rw-r--r--    1 root     root             4 Jan  1  2000 multid.pid
-rw-r--r--    1 root     root             5 Apr 26 19:31 ntpd.pid
-rw-r--r--    1 root     root            90 Jan  1  2000 onlinestat
-rw-r--r--    1 root     root             5 Jan  1  2000 openvpn.pid
drwxr-xr-x    2 root     root            60 Jan  1  2000 phonebook
-rw-r--r--    1 root     root             5 Jan  1  2000 rrdstats.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 spindown.sda.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 syslogd.pid
-rw-r--r--    1 root     root             5 Apr 26 19:37 vnstat.pid
-rw-r--r--    1 root     root             5 Apr 26 19:37 vnstatd.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 voipd.pid
drwxr-xr-x    2 root     root            40 Jan  1  2000 vsftpd
-rw-r--r--    1 root     root             5 Jan  1  2000 vsftpd.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 webcfg-rrd.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 webcfg-wol.pid
-rw-r--r--    1 root     root             5 Jan  1  2000 webcfg.pid

After a reboot /var/run/lighttpd is gone and isn't recreated by lighttpd.

The /var/run/lighttpd I talked about earlier:

Code:
root@fritz:/var/run# ls -l |grep light
drwxrwxrwx    2 wwwrun   wwwrun         100 Apr 26 16:24 lighttpd
-rw-r--r--    1 root     root             6 Apr 26 16:27 lighttpd.pid

I created it, as I said, manually for that reason. That didn't make a difference. So is it perhaps a permission thing higher in the tree?
 
I wanted to see the permissions of the directories not of their contents. ;-)

/var/run/lighttpd should be create automatically!?
 
After a reboot lighttpd and php-cgi are running:

Code:
root@fritz:/var/mod/root# ps | egrep -e "light|php"|grep -v grep
 9088 wwwrun    4264 S    lighttpd -f /mod/etc/lighttpd/lighttpd.conf
 9089 wwwrun    9276 S    /usr/bin/php-cgi
 9094 wwwrun    9276 S    /usr/bin/php-cgi
 9095 wwwrun    9276 S    /usr/bin/php-cgi
 9101 wwwrun    9276 S    /usr/bin/php-cgi
 9102 wwwrun    9276 S    /usr/bin/php-cgi
 9104 wwwrun    9276 S    /usr/bin/php-cgi

but:

Code:
root@fritz:/var/mod/root# ls -ld /var
drwxr-xr-x   18 root     root           800 Apr 26 20:24 /var
root@fritz:/var/mod/root# ls -ld /var/run
drwxr-xr-x    7 root     root           540 Apr 26 20:59 /var/run
root@fritz:/var/mod/root# ls -ld /var/run/lighttpd
ls: /var/run/lighttpd: No such file or directory

Trying to load a .php file doesn't create /var/run/lighttpd either.
 
Zuletzt bearbeitet:
I'm running out of ideas...

Do you use the chrooted version? But this works for me too. Perhaps you can post your lighttp configuration?

Regards
Oliver
 
Then the sockets are created in /var/media/ftp/uStor05/ext/www/htdocs/var/run/lighttpd. Please look at the permissions of ustor5, ext, www and htdocs path.

Regards
Oliver
 
Which filesystem is uStor05 using?
I had a problem chrooting on an USB stick with FAT32, because some device-nodes (I don't remember exactly) cannot be created on FAT32.
 
uStor05 is using ext2:

Code:
root@fritz:/var/mod/root# mount|egrep uStor05
/dev/sda5 on /var/media/ftp/uStor05 type ext2 (rw,noatime,nodiratime)

Directory permissions:
Code:
root@fritz:/var/mod/root# ls -ld /var/media/ftp/uStor05
drwxr-xr-x    5 root     root          4096 Apr 13 20:36 /var/media/ftp/uStor05
root@fritz:/var/mod/root# ls -ld /var/media/ftp/uStor05/ext
drwxr-xr-x   10 root     root          4096 Apr 25 23:11 /var/media/ftp/uStor05/ext
root@fritz:/var/mod/root# ls -ld /var/media/ftp/uStor05/ext/www
drwxrwxrwx    5 wwwrun   wwwrun        4096 Feb  7  2010 /var/media/ftp/uStor05/ext/www
root@fritz:/var/mod/root# ls -ld /var/media/ftp/uStor05/ext/www/htdocs
drwxrwxrwx    8 wwwrun   wwwrun        4096 Apr 26 22:52 /var/media/ftp/uStor05/ext/www/htdocs
 
I finally got phpinfo.php to load by starting a new "www tree" and using "no chroot". With "use chroot" I still get the same errors:

Code:
2011-04-27 19:06:31: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-2 
2011-04-27 19:06:31: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2011-04-27 19:06:31: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-1 
2011-04-27 19:06:31: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 1 load: 1 
2011-04-27 19:06:31: (mod_fastcgi.c.1734) connect failed: Permission denied on unix:/var/run/lighttpd/php-fastcgi.socket-0 
2011-04-27 19:06:31: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 2 load: 1 
2011-04-27 19:06:33: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket 
2011-04-27 19:06:33: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket 
2011-04-27 19:06:33: (mod_fastcgi.c.2785) fcgi-server re-enabled:  0 /var/run/lighttpd/php-fastcgi.socket
 
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.