PHP-FPM with LiteSpeed under cPanel

Discussion in 'PHP' started by GrAlex, Mar 2, 2017.

  1. GrAlex

    GrAlex New Member


    Logged as root in cPanel, and on a page "Set PHP Version per Domain" I've set PHP Version to ea-php56 and PHP-FPM is ON for a specific domain. And still phpinfo() under the domain shows: Server API LiteSpeed V6.10.

    I see a FPM pool is created, the config files exists in /opt/cpanel/ea-php56/root/etc/php-fpm.d/ and socket is ready /opt/cpanel/ea-php56/root/usr/var/run/php-fpm/94d49cf160dc86bb345671f4a1c956d336aad50f.sock, but still LiteSpeed ignores chosen PHP-mode and still handles all the requests via lsphp.

    Is it an issue of cPanel or LiteSpeed? And how can I set LiteSpeed to use PHP-FPM for my domain?
  2. Pong

    Pong Well-Known Member Staff Member

    It is expected by design. LiteSpeed should use lsphp while apache may use fastcgi/suphp/php-fpm. LSPHP has better performance than other handlers, which is one of the reason to make LiteSpeed faster.
  3. GrAlex

    GrAlex New Member

  4. Pong

    Pong Well-Known Member Staff Member

    Unfortunately, it is unsupported on the WHM/cpanel server.
  5. GrAlex

    GrAlex New Member

    OK, thanks.
  6. Crazy Serb

    Crazy Serb Active Member

    Funny, because I find that the minute I turn on the PHP suEXEC option in Litespeed over any other handler/option, the CPU usage at least doubles and all the sites start loading much, much slower. As in, a big site that usually loads in 2 seconds takes anywhere from 12-20 seconds to load with PHP suEXEC turned on.

    So much for better performance...

    And if Litespeed is on, but PHP suEXEC option is turned off, what does PHP use as a handler then? Whatever we set in WHM -> MultiPHP Manager section where it gives us the option of handlers (cgi, none, suphp) or PHP-FPM?!
  7. Pong

    Pong Well-Known Member Staff Member

    First, let's clarify about PHP SuEXEC:
    PHP suEXEC is not PHP handler. For Apache, If you run shared hosting server, you will have to run PHP SuEXEC mode for apache, otherwise one user may be able to access other users's files. PHP SuEXEC is generally slower than non-PHP SuEXEC mode. It is normally set when you cpanel first installed with your apache and generally you can't change the mode after to avoid permission problem.
    Once your apache set to PHP SuEXEC(yes or no), LSWS will pick up the setting during the LSWS installation. You can NOT switch between Non-SuEXEC and PHP SuEXEC.

    Second, once the PHP SuEXEC is set for both Apache and LSWS, in terms of the PHP handler, LSPHP is better than Apache php-fpm, cgi, SuPHP(no matter PHP SuEXEC is on, or Off)

    Third, but the most important, you should enable cache avoid PHP processes, which is the most important mothod to make your site fly, PHP handler doesn't help much because Cache is 1000x time faster,
    Last edited: Aug 14, 2018

Share This Page