[solved] Build Matching PHP 5.3.25 with LSAPI

Discussion in 'Install/Configuration' started by muiruri, Jun 3, 2013.

  1. muiruri

    muiruri Well-Known Member

    On cpanel server server, after upgrading MySQL to version 5.1 and PHP to version 5.3.25, Litespeed does not work.

    Litespeed was working perfectly well before.

    Have tried to re-install Litespeed many times, with no success.

    Problem is after running easyapache, to re-compile apache with new PHP 5.3.245, when I go to LSWS console, next select Build Matching PHP Binary, next I click on "NEXT" button to continue, I get following error;

    Start building PHP 5.3.25 with LSAPI
    Mon Jun 3 14:14:02 EAT 2013

    Changing to build directory /home/cpeasyapache/ls.src
    **ERROR** Cannot find php build directory for cPanel, please run EasyApache first to build PHP with correct options for

    However, if I re-install Litespeed, then go to LiteSpeed Configuration, next go to Admin Web Console, next select Action menu, next select Compile PHP

    This option works to Build Matching PHP Binary, however when it's finished and restart Litespeed, when I go to Litespeed home page and select Build Matching PHP Binary I now get following message;

    Found Apache php binary at /usr/local/bin/php. Version is 5.3.25
    Found LiteSpeed php binary at /usr/local/lsws/fcgi-bin/lsphp5. Version is 5.3.25
    Apache php configuration has more options that are not available or different in lsphp:

    Which appears to say it worked but there was still a problem.

    And at this point, when I try to switch or even restart to Litespeed does not work.

    And even if I try Build Matching PHP Binary, keeps on saying " Cannot find php build directory for cPanel, please run EasyApache..." and have re-run easyapache many times but does not help. Therefore must be something else I'm missing.

    Why does this happen?

    How will be able to make use or make "Build Matching PHP Binary" work?
    Last edited by a moderator: Jun 14, 2013
  2. webizen

    webizen Well-Known Member

    Try build matching php from Admin Console, use /usr/local in Install Path Prefix (default is /usr/local/lsws/lsphp5). Then try build matching php from WHM plugin.
  3. muiruri

    muiruri Well-Known Member

    Thanks, that resolved the issue.

    Building matching PHP was finally successful this time.

    One more question, is when I was using this console menu option to build matching PHP, there was add-ons which are not normally listed on the home page "build matching PHP" default ticked or selected was "indetify PHP mail header" and other three eaccelerator, xchache & memcahe were un-checked.

    I'm using eaccelerator on this server and was not sure if I should have ticked that option, therefore since I did not select. Believe I can still enable from one of the console menu options, right?

    Regards, Sam
  4. webizen

    webizen Well-Known Member

    console menu can build its own lsphp (not matching Apache) if use different set of compile options. those add-ons are different from those in easy apache. So, yes, you can select EA in console menu option, it will be enabled in the newly built lsphp (make sure entry 'extension=eaccelerator.so' is added to the php.ini).
  5. muiruri

    muiruri Well-Known Member

    All looking good, but LSWS is now refusing to start.

    When I look at log file;


    get the following;

    restart, LSWS running: 0
    LSWS does not restart properly, check port 7080
    checking port 7080 usage with netstat
    checking port 7080 usage with lsof
    check port 7080 after kill all litespeed processes
    checking port 7080 usage with netstat
    checking port 7080 usage with lsof

    Port 7080 is enabled on firewall even tried to temporary disable firewall, but does not help.

    Any ideas?
  6. muiruri

    muiruri Well-Known Member

    Also having another issue, when I switch to LSWS, application like Wordpress does not load and gives error;

    Your PHP installation appears to be missing the MySQL extension which is required by WordPress

    Also application such as Joomla does not load as well and gives page holder saying site on maintenance mode.

    But when I switch back to Apache works fine.

    What I'm I missing?
  7. muiruri

    muiruri Well-Known Member

    Did another Litespeed PHP recompile with all flags Apache is using and now sites working fine, except following two problems;

    1) When I go to LSWS home page, then click on "Build Matching PHP Binary" to see if there's any errors, find the following;

    Found Apache php binary at /usr/local/bin/php. Version is 5.3.25
    Found LiteSpeed php binary at /usr/local/lsws/fcgi-bin/lsphp5. Version is 5.3.25
    Apache php configuration has more options that are not available or different in lsphp:

    2) Some sites, such as Joomla show error at the top saying;

    Warning: date() [function.date]: It is not safe to rely on the system's timezone settings

    On the file; /usr/local/lib/php.ini

    Have two lines saying;

    date.timezone = Country/City

    But still showing error. Tried with and without quotes as well.

    However for some strange reason, if I add the same line in one of the joomla sites inside .htaccess with line as;

    php_value date.timezone Country/City

    Works fine.

    Because they're other sites on the same server, how can this be done at php.ini

    What do you think?
  8. NiteWave

    NiteWave Administrator


    what is "Loaded Configuration File "? /usr/local/lib/php.ini ?
  9. muiruri

    muiruri Well-Known Member

    The Configuration File (php.ini) Path is showing;


    Should I be having a php.ini in here? with the date commmand line?
  10. muiruri

    muiruri Well-Known Member

    Ops, now I see below that at the box for;

    Loaded Configuration File

    shows (none)
  11. muiruri

    muiruri Well-Known Member

    How do I add on this box;


    Is there a menu option in Litepseed to add?
  12. NiteWave

    NiteWave Administrator

    this can be done by changing
    admin console->Server->External App->lsphp5->
    Command:$SERVER_ROOT/fcgi-bin/lsphp5 -c /usr/local/lib

    but this hack is not correct way to resolve your issue.

    the issue in your 1st post looks a bit weird. it should not happen.
    not sure it's a usage issue or bug.

    and what's your lsws version, 4.2.2 or 4.2.3 ?
  13. muiruri

    muiruri Well-Known Member

    Using LSWS 4.2.3

    I did not re-compile using console menu under Actions -> Compile PHP

    And here this time at the box for;

    Install Path Prefix;

    changed the default; /usr/local/lsws/lsphp5

    to /usr/local

    And now websites appears to work well with no more error.

    However, now when I go to WHM, then select Litespeed Web server, then select "Build Matching PHP Binary" shows following error message;

    Found Errors

    ERROR: /usr/local/bin/php -i returns 127
    PHP Version => 5.3.25

    following by all infor one would see from phpinfo at the bottom message saying;

    You can try to build matching PHP from command line:

    What do you think?
  14. NiteWave

    NiteWave Administrator

    it's ok to try
  15. muiruri

    muiruri Well-Known Member

    When I SSH into server and run command get following;

    ### /usr/local/cpanel/whostmgr/cgi/lsws/cmd_buildmatchingphp.sh
    Found Apache php binary at /usr/local/bin/php Version is 5.3.25
    Found LiteSpeed php binary at /usr/local/lsws/fcgi-bin/lsphp5. Version is 5.3.25
    Configuration options for lsphp and Apache php are matched.
    No need to rebuild. Aborted! If you want to do force rebuid, add parameter -f

    What do you think?
  16. NiteWave

    NiteWave Administrator

    that means, anyway, you've done "Building Matching PHP" successfully.
    no more actions needed.

    for cPanel users, if you want to rebuild php, always go EasyApache first, then build matching php, it's not recommended to build php from admin console->Compile PHP directly.
  17. muiruri

    muiruri Well-Known Member

    Sounds good, but problem now is;

    1) "Build Matching PHP Binary" on LSWS home page will never work & every time I do a change on PHP & run easyapache, on LSWS I have to use the direct console menu option to "Compile PHP" directly

    2) On this same menu option, "Build Matching PHP Binary" when I open will always be showing;

    Found Errors;
    ERROR: /usr/local/bin/php -i returns 127
    PHP Version => 5.3.25

    3) One more thing I'm not sure of is at menu option "Enable EasyApache Integration" also at LSWS home page, if to enable to disable, because normally for our cpanel servers, before we run easy apache we normally switch to Apache first, then after easy apache run "Build Matching PHP Binary" then finally siwtch back to LSWS
  18. NiteWave

    NiteWave Administrator

    1)"on LSWS I have to use the direct console menu option to "Compile PHP" directly" -- this step should not be necessary at all. though not know the root cause at the time being.

    2)please refer
    Step 3: Build matching PHP binary
    try increase "Max cPanel process memory (minimum: 256)" in cPanel (Main > Server Configuration > Tweak Settings) to at lease 512MB.
    see if it resolves this issue

    3)nowadays, no need switch to apache to run easyapache. the above wiki entry also delete this statement --
    Last edited: Jun 5, 2013
  19. muiruri

    muiruri Well-Known Member

    (a) Just tried to increase (Main > Server Configuration > Tweak Settings) to 2048

    And tried again to run command;


    And get the same error message.

    Tried that before as well, with memory bumped up to 512, then 1024, but still get same error.

    (b) Also have tried re-installing LSWS several times, by going to WHM, select LSWS, then click on "Uninstall" number of times during un-install process, selected to retain config files, then other times selected to remove / delete config files, but in both cases still cannot use Build matching PHP binary menu option.
  20. NiteWave

    NiteWave Administrator

    I'd log in your server to see what is happening. please PM the root access or you create a ticket in WHMCS.

Share This Page