Search code examples
phpwhmfpm

PHP manager toggle switch for php-fpm in WHM


In WHM under the "php-manager" there is a toggle switch (shown below) What is the function of this check box? How is php-run with it set to ON and how it is run with the switch set to OFF?

enter image description here

I also double checked the apache-modules that are compiled with apache and they are:

enter image description here

So is php run one way with the php-fpm set to ON and run another way with the switch set to OFF?

more importantly, how can I know what is the current running mode from inside php? (how to echo\view that?).


Solution

  • That's the button for enabling PHP-FPM (FastCGI Process Manager). Turning it off makes your application revert back to using FastCGI.

    CGI is a protocol (Common Gateway Interface). It's not just for PHP but also for other server-side languages. The web server itself starts a new CGI-compliant process for each request. FastCGI addressed the limitations of CGI, especially its resource load during high traffic due to calling multiple processes.

    Sidenote: The older method was using PHP just as an Apache module (mod_php). Everything was handled by the Apache process. Its configuration is defined in Apache's. PHP even runs as the Apache user, having its permissions.

    PHP-FPM operates as a separate FastCGI server and Apache connects to it. In it, "permissions, processes-related stuff and everything else" are controlled by the PHP-FPM server. See "Differences and dis/advanages between: Fast-CGI, CGI, Mod-PHP, SuPHP, PHP-FPM" (Server Fault). It is superior to the older FastCGI but needs to be configured. Other answers explain it better in detail. It has been part of core PHP roughly since PHP 5.3.3. You can do further research on this.

    Some links:


    more importantly, how can I know what is the current running mode from inside php? (how to echo\view that?).

    You can by outputting the value of php_sapi_name(): Returns the type of interface between web server and PHP (I got this from Pascal MARTIN's answer for "What is mod_php?", phpinfo() also is said to work.)

    I used it on my server and it returned "cgi-fcgi" when the PHP-FPM button was off.