[Solved] Litespeed not running suEXEC/LSAPI

#1
Hi guys, I've installed the standard version of the Litespeed Web Server.

Facing some problems with getting php files to run under suEXEC/LSAPI. Is suEXEC and LSAPI the same thing?

I can't seem to get my php files to run under the owner of the file. My Litespeed runs as nobody/nobody. My php script runs under user1/user1.

I created a php file to print out system('whoami') but I'm getting nobody instead of user1. It seems that the script is still running under the web server.

Would appreciate if someone could guide me on how this can be done and what is a proper way to verify php is running in suEXEC/LSAPI?

--

On a side note, does the default Litespeed comes with PHP 4 only? How do I switch to PHP 5? When I do a phpinfo(), it shows version 4.4.9.


Thanks for the help in advance.
 
#2
The is the output when I run the script below. PHP is running as nobody and not the script owner.

UID PID PPID C STIME TTY TIME CMD
nobody 3522 3494 0 21:37 ? 00:00:00

-----
lsphp5:/usr/local/lsws/DEFAULT/html/id.php
$pid=getmypid();
echo "getmypid()=" . $pid ."<br>";
echo "<hr><pre>";
system("ps -fp " . $pid);
echo "</pre><hr>";
---------
 

webizen

Well-Known Member
#3
suEXEC and LSAPI are NOT the same thing. LSAPI +PHP can be used run with suEXEC set to No, Yes, etc.

suEXEC in "Using Apache Configuration File" is for vhost in httpd.conf (Apache). you need something like below in vhost config for PHP suEXEC => Yes to work.
SuexecUserGroup user1 group1
For native LSWS vhost, you can set suEXEC user in lsphp5 either at server level or vhost level.

Regarding stock php in LSWS, it is php4 for small footprint which is good enough to get one started. You can compile a newer php version in Compile PHP page (Admin CP => Actions => Compile PHP). More details are at

http://www.litespeedtech.com/support/wiki/doku.php#php ==> PHP 4/5 with LSAPI
 
#4
Thanks for the reply.

So how do I run my php scripts under the owner and not the web server? Should it be LSAPI or suEXEC in this case?

I've already set the suEXEC user & group under Ext Application. I've also set the CGI set UID mode to DocRoot UID. But it still doesn't work. Is there anything I left out?

What must the permission of the document root and all files beneath it be?

Appreciate a walk through on how I can enable this from the base installation of Litespeed.

Thanks!
 

webizen

Well-Known Member
#5
LSAPI + PHP is recommended for its performance and security regardless of suEXEC.

For LSWS native vhost, in Admin CP => Virtual Host
Basic tab: ExtApp Set UID Mode => Docroot UID
External App: create vhost level lsphp5 ext app
Script Handler: suffix php => vhost lsphp5 ext app

chown docroot to userid desired, then restart lsws. PHP (LSPHP) should follow docroot uid.

CGI File UID is for CGI script (slow) not for LSAPI + PHP.
 
Top