[Solved] Litespeed not running suEXEC/LSAPI

Discussion in 'Install/Configuration' started by thelunny, Feb 8, 2012.

  1. thelunny

    thelunny Member

    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. thelunny

    thelunny Member

    The is the output when I run the script below. PHP is running as nobody and not the script owner.

    nobody 3522 3494 0 21:37 ? 00:00:00

    echo "getmypid()=" . $pid ."<br>";
    echo "<hr><pre>";
    system("ps -fp " . $pid);
    echo "</pre><hr>";
  3. webizen

    webizen Well-Known Member

    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.
    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. thelunny

    thelunny Member

    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.

  5. webizen

    webizen Well-Known Member

    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.
  6. thelunny

    thelunny Member

    I managed to got it running. thanks! :D

Share This Page