PDA

View Full Version : PHP 5.2.5 gets 503 error


robfrew
12-14-2007, 08:41 AM
We are evaluating LSWS for use and have installed the trial version. Here are the server specs:

Dual Intel Woodcrest 5130 Dual Processors
4GB Ram
RHEL 5

Apache has been uninstalled as well as RPM versions of PHP and MySQL.

We installed LSWS 3.3.2 without any problems. We are using CHROOT and the path is /chroot/opt/lsws.

We tried installing the latest PHP (5.2.5) using the LSWS web panel but it hangs for some reason. We decided to install PHP manually. We followed the steps on your PHP SAPI installation page and after successful installation, we installed XCache. Everything looked successful. We checked the version and it shows:

[root@ns fcgi-bin]# ./lsphp -v
PHP 5.2.5 (litespeed) (built: Dec 13 2007 18:29:03)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with XCache v1.2.1, Copyright (c) 2005-2007, by mOo

However, when we go to our webserver at http://www.mxxm.com/phpinfo.php, we get a 503 error.

We checked the logs and here is what they say:

2007-12-13 19:46:17.852 INFO [phpLsapi] add child process pid: 13848
2007-12-13 19:46:17.852 INFO [phpLsapi] pid list size: 1
2007-12-13 19:46:17.853 INFO Remove pid: 13848
2007-12-13 19:46:17.853 INFO Pid: 13848 associated with [phpLsapi]
2007-12-13 19:46:17.853 INFO [phpLsapi] pid list size: 0, pid stop list size: 0
2007-12-13 19:46:17.853 NOTICE [phpLsapi] stop worker processes
2007-12-13 19:46:17.853 INFO [phpLsapi] 1 request being processed, kill external app later.
2007-12-13 19:46:17.853 INFO [67.177.5.191:63870-0#Example] connection to [uds://tmp/lshttpd/lsphp.sock] on request #0, error: Connection reset by peer!
2007-12-13 19:46:17.853 INFO [phpLsapi] add child process pid: 13849
2007-12-13 19:46:17.853 INFO [phpLsapi] pid list size: 1
2007-12-13 19:46:17.854 INFO Remove pid: 13849
2007-12-13 19:46:17.854 INFO Pid: 13849 associated with [phpLsapi]
2007-12-13 19:46:17.854 INFO [phpLsapi] pid list size: 0, pid stop list size: 0
2007-12-13 19:46:17.854 NOTICE [phpLsapi] stop worker processes
2007-12-13 19:46:17.854 INFO [phpLsapi] 1 request being processed, kill external app later.
2007-12-13 19:46:17.854 INFO [67.177.5.191:63870-0#Example] connection to [uds://tmp/lshttpd/lsphp.sock] on request #0, error: Connection reset by peer!
2007-12-13 19:46:17.854 INFO [phpLsapi] add child process pid: 13850
2007-12-13 19:46:17.854 INFO [phpLsapi] pid list size: 1
2007-12-13 19:46:17.854 INFO Remove pid: 13850
2007-12-13 19:46:17.854 INFO Pid: 13850 associated with [phpLsapi]
2007-12-13 19:46:17.854 INFO [phpLsapi] pid list size: 0, pid stop list size: 0
2007-12-13 19:46:17.854 NOTICE [phpLsapi] stop worker processes
2007-12-13 19:46:17.855 INFO [phpLsapi] 1 request being processed, kill external app later.
2007-12-13 19:46:17.855 INFO [67.177.5.191:63870-0#Example] connection to [uds://tmp/lshttpd/lsphp.sock] on request #0, error: Connection reset by peer!
2007-12-13 19:46:17.855 NOTICE [67.177.5.191:63870-0#Example] oops! 503 Service Unavailable
2007-12-13 19:46:17.855 NOTICE [67.177.5.191:63870-0#Example] Content len: 0, Request line:
GET /phpinfo.php HTTP/1.1

Any suggestions?

Rob

mistwang
12-14-2007, 09:20 AM
the problem is the chroot, it is not easy to find out what library is missing in chroot.
We have to command line tool, lsws/admin/misc/chroot.sh, can help a little bit.

chroot.sh /chroot <php_binary>

It will fix the missing libraries that linked to <php_binary>, listed with "ldd <php_binary>".

Since PHP also load extension dynamically, you need to use command

chroot /chroot <php_binary> -i

To test it, and fix all errors at the beginning of the output.

robfrew
12-14-2007, 10:04 AM
That fixed it. Thanks.

robfrew
12-14-2007, 10:05 AM
For others who may have this issue, I will post the commands I used for MY system, your PATHS and FILE names may be different so adjust accordingly. These commands are executed in /chroot/opt/lsws/fcgi-bin/ directory.

/chroot/opt/lsws/admin/misc/chroot.sh /chroot/opt/lsws lsphp

/chroot/opt/lsws/admin/misc/chroot.sh /chroot/opt/lsws lsphp -i

robfrew
12-14-2007, 10:09 AM
So now, when I go to http://www.mxxm.com/phpinfo.php, I see the PHP info page but it's not listing XCache as the optimizer. However, when I check the version at the command line using lsphp -v, it shows up.

Ideas?

mistwang
12-14-2007, 10:18 AM
You have to use
chroot /chroot <php_path> -i

to verify everything.

robfrew
12-14-2007, 10:26 AM
Here is what I tried and here is the output:

[root@ns fcgi-bin]# chroot /chroot lsphp -i
chroot: cannot run command `lsphp': No such file or directory

I even tried:

[root@ns php]# chroot /chroot /chroot/opt/lsws/fcgi-bin/lsphp -i
chroot: cannot run command `/chroot/opt/lsws/fcgi-bin/lsphp': No such file or directory


Did I do something wrong?

mistwang
12-14-2007, 11:21 AM
chroot /chroot /opt/lsws/fcgi-bin/lsphp -i

robfrew
12-14-2007, 11:44 AM
Same result:

[root@ns lsws]# chroot /chroot /opt/lsws/fcgi-bin/lsphp -i
chroot: cannot run command `/opt/lsws/fcgi-bin/lsphp': Not a directory

mistwang
12-14-2007, 11:56 AM
The error are different, maybe something missing in the chroot.
You can copy over "strace" command to the chroot jail.

The do
chroot /chroot strace /opt/lsws/fcgi-bin/lsphp -i

The output will tell you what is missing.

For the xcache issue, you can also check lsws/logs/stderr.log see if any error related.