Forum

PHP5-CGI and Hiawatha 7.4 in a CHROOT

Hiawatha not connecting/Findin
20 March 2011, 15:56
Hiawatha version: 7.4
Operating System: Ubuntu 10.10

Hi, im running Hiawatha 7.4 in a CHROOT alongside PHP5 in ubuntu.
Basically, my problem is - i cant execute any PHP files (i've enabled ExecuteCGI in hiawatha.conf), but my log just show this:

Sun 20 Mar 2011 14:48:52 +0000|127.0.0.1|/CHROOTS/HiawathaPHP/var/www/hiawatha/index.php|execute CGI: No such file or directory
Sun 20 Mar 2011 14:48:52 +0000|127.0.0.1|/CHROOTS/HiawathaPHP/var/www/hiawatha/index.php|no output

Heres my php-fcgi.conf:
PidFile = /CHROOTS/HiawathaPHP/var/run/php-fcgi.pid
Forks = 3
MaxRequests = 100
Server = /usr/bin/php5-cgi ; 127.0.0.1:90583 ; www-data
Server = /CHROOTS/HiawathaPHP/usr/bin/php5-cgi ; 127.0.0.1:6589 ; 1000:100,101
Server = /CHROOTS/HiawathaPHP/usr/bin/php5-cgi ; 127.0.0.1:90583 ; www-data ; /CHROOTS/HiawathaPHP/etc/php5/cgi/php.ini
Server = /CHROOTS/HiawathaPHP/usr/chroot/PHP5|/CHROOTS/HiawathaPHP/usr/bin/php5-cgi ; 127.0.0.1:90583 ; www-data


This is one of out production servers and were planning on switching to Hiawatha as soon as possible.

Any help will be greatly appreciated
Thanks
Hugo Leisink
24 March 2011, 09:37
Sorry for the late response.

First of all, chroot is not something to take lightly. Only use it if you really really want to. I recommend to use Ubuntu's apparmor instead of chroot.

In your php-fcgi.conf, you have 2 FastCGI daemons running on port 90583. That will not work. Each server must have its own port.

The path of the last one is a bit strange. My guess is that "/CHROOTS/HiawathaPHP/usr/chroot/PHP5|/CHROOTS/HiawathaPHP/usr/bin/php5-cgi" should be "/CHROOTS/HiawathaPHP|usr/bin/php5-cgi". With that, the php5-cgi in /CHROOTS/HiawathaPHP/usr/bin will be chrooted to /CHROOTS/HiawathaPHP.

Note that if you do chroot a FastCGI daemon, it will no longer know about the /CHROOTS/HiawathaPHP directory. It will only see what's inside that directory. For that daemon, /CHROOTS/HiawathaPHP has become /. This applies to the PHP scripts as well. And don't forget the ServerRoot option in the FastCGIserver block in hiawatha.conf.
This topic has been closed.