[Solved] problem with php

#1
hello
i have problem with perl script today
i dont have any change to server configration but in litespeed mode my perl programs cant run
i dont have any problem with apache and only have this problem with litespeed
 
#3
when i switch my web server to litespeed users cant upload files from php script , ...
i have this problem only on one of my servers


and this is litespeed error log :


2011-03-13 21:49:07.622 [NOTICE] [PID: 19742]: start cgid: 19745, /usr/local/lsws/bin/httpd
2011-03-13 21:49:07.622 [WARN] [config:server:listener] No listener is available for normal virtual host!
2011-03-13 21:49:07.622 [NOTICE] The maximum number of file descriptor limit is set to 6000.
2011-03-13 21:49:07.622 [NOTICE] [config:server:epsr:lsphp5]'Process Limit' probably is too low, adjust the limit to: 310.
2011-03-13 21:49:07.622 [NOTICE] [config:server:epsr:lsphp4]'Process Limit' probably is too low, adjust the limit to: 310.
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/includes/pre_main_global.conf
2011-03-13 21:49:07.624 [WARN] /usr/local/apache/conf/includes/pre_main_global.conf:3: Directive 'suPHP_ConfigPath' is not allowed in current context.
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/includes/pre_main_2.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/php.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/mod_bandwidth.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/includes/errordocument.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/modsec2.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/modsec2.user.conf
2011-03-13 21:49:07.624 [INFO] Processing config file: /usr/local/apache/conf/modsec2.whitelist.conf
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.624 [ERROR] [config] rewrite: unknown server variable while parsing: RESPONSE_BODY
2011-03-13 21:49:07.643 [INFO] Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_global.conf
2011-03-13 21:49:07.643 [INFO] Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_global.conf
2011-03-13 21:49:07.643 [INFO] Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_2.conf
2011-03-13 21:49:07.643 [INFO] Processing config file: /usr/local/apache/conf/includes
 

webizen

Well-Known Member
#4
what lsws version are you running?

The logs captured looks like when litespeed was first started. you need to capture the log entries around the time when upload script failed. That should give us details of the error.
 
#5
Current Version: 4.0.20

i see below error in litespeed log
when i upload a file

ERROR [[HTAccess]] rewrite: unknown server variable while parsing: ^multipart/form-data;)"
 
#8
after install 4.1RC5 my problem not fixed and i cant switch to apache now error :
i killed all litespeed process but cant switch to apache

LSWS Stopped.
[OK] litespeed: pid=26110.
Apache is not up within 30 secs, try again by force kill litespeed.
[OK] litespeed: pid=26513.
Apache is still not up.

Failed to switch to Apache! Please either start LiteSpeed or manually switch to Apache!

Apache is not started may be caused by configuration error. To manually check this problem, please ssh to your server and check:

Try stop LiteSpeed if lshttpd still running:
killall -9 lshttpd

remove the lsws wrapper if the original one is found:

restore Apache httpd if /usr/local/apache/bin/httpd_ls_bak exists.
mv -f /usr/local/apache/bin/httpd_ls_bak /usr/local/apache/bin/httpd

restore cPanel restart httpd script if /scripts/restartsrv_httpd_ls_bak exists.
mv -f /scripts/restartsrv_httpd_ls_bak /scripts/restartsrv_httpd

run the restart command manually: /scripts/restartsrv_httpd and check the error.
 
Last edited:
#12
thanks :x

i have one problem i cant switch to apache to compile my php from easy apache
/usr/local/apache/bin/httpd
and i replaced it with httpd file
but my problem not fixed
 

webizen

Well-Known Member
#13
Further checking reveals that Apache could not start because mod_auth_passthrough.so file was in the wrong folder /usr/local/apache/modules/modules! Most likely it was messed up when you copied files around.

root@mydc [/usr/local/apache/bin]# /scripts/restartsrv_httpd
httpd: Syntax error on line 34 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/mod_auth_passthrough.so into server: /usr/local/apache/modules/mod_auth_passthrough.so: cannot open shared object file: No such file or directory

root@mydc [/usr/local/apache/bin]# ls ../modules/
./ ../ mod_perl.so* modules/
root@mydc [/usr/local/apache/bin]# ls ../modules/modules/
./ httpd.exp mod_auth_passthrough.so* mod_bw.so* mod_frontpage.so* mod_security2.so*
../ libphp5.so* mod_bwlimited.so* mod_disable_suexec.so* mod_perl.so* mod_suphp.so*

root@mydc [/usr/local/apache/bin]# ls -l ../modules/
total 1396
drwxr-xr-x 3 root root 4096 Mar 14 01:21 ./
drwxr-xr-x 18 root root 4096 Mar 14 01:21 ../
-rwxr-xr-x 1 root root 1409919 Mar 14 01:21 mod_perl.so*
drwxr-xr-x 2 root root 4096 Mar 14 01:21 modules/

root@mydc [/usr/local/apache/bin]# ls -l ../modules/modules/
total 22508
drwxr-xr-x 2 root root 4096 Mar 14 01:21 ./
drwxr-xr-x 3 root root 4096 Mar 14 01:21 ../
-rw-r--r-- 1 root root 9106 Mar 14 01:21 httpd.exp
-rwxr-xr-x 1 root root 20216303 Mar 14 01:21 libphp5.so*
-rwxr-xr-x 1 root root 10209 Mar 14 01:21 mod_auth_passthrough.so*
-rwxr-xr-x 1 root root 9433 Mar 14 01:21 mod_bwlimited.so*
-rwxr-xr-x 1 root root 29544 Mar 14 01:21 mod_bw.so*
-rwxr-xr-x 1 root root 5776 Mar 14 01:21 mod_disable_suexec.so*
-rwxr-xr-x 1 root root 51044 Mar 14 01:21 mod_frontpage.so*
-rwxr-xr-x 1 root root 1409919 Mar 14 01:21 mod_perl.so*
-rwxr-xr-x 1 root root 1173890 Mar 14 01:21 mod_security2.so*
-rwxr-xr-x 1 root root 60119 Mar 14 01:21 mod_suphp.so*
root@mydc [/usr/local/apache/bin]#
It is OK now. You can switch between Apache and LiteSpeed.
 
Last edited:

webizen

Well-Known Member
#14
Update:

The file /etc/cxs/cxscgi.sh is empty (all lines are commented out) except for the first line "#!/bin/sh"

According to suhosin document (http://www.hardened-php.net/suhosin/configuration.html#suhosin.upload.verification_script), it needs something like "echo 1" as its first line to allow upload.
The called script has to write a 1 as first line to standard output to allow the upload. Any other value or no output at all will result in the file being deleted.
Added that line ("echo 1") to the script and uncommented the line in /usr/local/lib/php.ini. file upload is working.
suhosin.upload.verification_script = "/etc/cxs/cxscgi.sh"
So the cause of "File upload stopped by extension" error is /etc/cxs/cxscgi.sh script not having "1" as first line in standard output (no output in this case).
 
Last edited:
#15
Hello,

I'm using CXS for scanning uploaded files and prevent users from uploading malicious files to the server.
But recently my server load is growing up and sometimes becomes too high (more than 20 or even 30) due to high traffics on apache.
My server manager suggesting me to get litespeed. But as CXS official website says, litespeed does not support some mod_security rules that needed by CXS, So it seems CXS will not work with litespeed.

But I see this guy is using CXS along with Litespeed! Isn't it ?
Does it make any problem?
Does CXS really works along with Litespeed?

Please correct me if I'm wrong. I seriously need the power of both CXS and Litespeed on my server (one for security and another one for speed)
 

webizen

Well-Known Member
#16
if your upload is handled via php, cxs should work with litespeed via suhosin hook (see cxs install.txt for how to enable suhosin hook).
 
Top