[Solved] PHP7 SuExec using VH Template - 503 error???

Discussion in 'Linux Support: Debian, Ubuntu, SolusOS etc' started by bluewombat, Nov 2, 2016.

  1. bluewombat

    bluewombat New Member

    I'm struggling to get PHP7 with SuExec using a VH Template.

    PHP 5.6 with standard VHost - works out of box
    PHP 7.0.10 with standard VHost - works with a bit of work.
    PHP 5.6 with shipped VH Template PHP_SuEXEC works and reports process uid as expected.

    PHP 7.0.10 with VH Template 'php-suexec-70' does not work properly.

    If I set VHost Template php-suexec-7 > Script Handler to use [Server Level]: lsphp70 it works except that the process username is 'nobody'.

    If I set VHost Template php-suexec-7 > Script Handler to use [VHost Level]: lsphp70 it gives 503 error

    Any ideas on what I might be missing??
    There is nothing useful in logs/error.log


    VHost Template php-suexec-7 > External App
    LiteSpeed SAPI App $VH_NAME_lsphp70 uds://tmp/lshttpd/$VH_NAME_lsphp70.sock
    Name $VH_NAME_lsphp70
    Address uds://tmp/lshttpd/$VH_NAME_lsphp70.sock

    VHost Template php-suexec-7 > Security
    ExtApp Set UID Mode DocRoot UID

    In conf/httpd.conf I have:
    extprocessor lsphp70 {
    type lsapi
    address uds://tmp/lshttpd/lsphp70.sock
    maxConns 35
    initTimeout 10
    retryTimeout 0
    persistConn 1
    respBuffer 0
    autoStart 1
    path $SERVER_ROOT/fcgi-bin/lsphp7
    backlog 100
    instances 1
    memSoftLimit 2047M
    memHardLimit 2047M
    procSoftLimit 400
    procHardLimit 500

    In conf/templates/php-suexec-7.conf
    extprocessor $VH_NAME_lsphp70 {
    type lsapi
    address uds://tmp/lshttpd/$VH_NAME_lsphp70.sock
    maxConns 5
    initTimeout 60
    retryTimeout 0
    persistConn 1
    pcKeepAliveTimeout 30
    respBuffer 1
    autoStart 1
    path $SERVER_ROOT/fcgi-bin/lsphp7
    backlog 10
    instances 5
    extMaxIdleTime 60
    priority 0
    memSoftLimit 100M
    memHardLimit 150M
    procSoftLimit 100
    procHardLimit 200
  2. lsfoo

    lsfoo Administrator

    Hi bluewombat,

    I have a few questions to help us debug:
    1. What OS are you using?
    2. How did you install OLS?
    3. Did you use any special parameters when installing?

  3. bluewombat

    bluewombat New Member

    Hi Kevin,

    thanks for helping.
    This is Ubuntu 14.04.4
    I installed OLS using a process similar to www digitalocean com/community/tutorials/how-to-install-the-openlitespeed-web-server-on-ubuntu-14-04
    I don't recall any special parameters.
    To get php 7.0.10 to build I had to iterate a few times to get missing dependencies installed, but I basically just followed the instructions in the Tools section.

    It all works well with the bundled php 5.6.14, but I can't seem to get the DocRoot UID type of SuExec to work for php 7.0.10
    Have a look at the examples below, which report process owner and docroot owner.
    p5.example.com.au p.php VHost Template PHP_SuEXEC > Script Handler php = [VHost Level]: $VH_NAME_lsphp
    p7.example.com.au p.php - VHost Template php-suexec-7 > Script Handler php = [Server Level]: lsphp70
    p7v.example.com.au p.php - VHost Template php-suexec-7 > Script Handler php = [VHost Level]: $VH_NAME_lsphp70

    For both PHP_SuEXEC and php-suexec-7, ExtApp Set UID Mode = DocRoot UID



    Edited by lsfoo: Removed domain.
    Last edited by a moderator: Nov 3, 2016
  4. lsfoo

    lsfoo Administrator

    Hi Danny,

    I can confirm that the server level returns nobody for me as well. However, I was able to get vhost level working with the correct user. Do you see anything in the error log that could explain why you are getting a 503 in that situation? Just visit the page again and there should be a log message related to it.

  5. lskagan

    lskagan Administrator

    Hi Danny,

    Kevin and I have been hard at work figuring out your issue. The reason you are getting a 503 error is because PHP7 requires higher memory usage. Currently if you just copied over the template and edited it the memory limits would have stayed the same. All you have to do to fix this is change the following:

    Memory Soft Limit (bytes) 100M -> 1000M
    Memory Hard Limit (bytes) 150M -> 1500M

    The 1000M and 1500M are just random numbers I chose to see if that was the cause. You can tweak it to your like by changing them and seeing if you still get a 503 error.

    Hope this helps you.

    Best Regards,
  6. bluewombat

    bluewombat New Member

    Thanks Jonathan and Kevin - this has solved the issue.
    I now get on my example page:

    Process owned by user: p7
    Docroot: /vhosts/p7v.example.com.au/public_html owned by user: p7​

    Please update the Subject line to add [SOLVED]

    Best regards,

    lsfoo likes this.

Share This Page