Ispmanager 6 lite, pro, host

PHP modes on CloudLinux

In ispmanager you can enable PHP scripts for a website. To do so, enable the PHP option and enter its parameters when creating or editing a website. Learn more in the article Add a website.

Supported PHP modes:

  • Apache module;
  • LSAPI;
  • CGI;
  • FastCGI (Apache);
  • FastCGI (Nginx + PHP-FPM).

  For more information about PHP settings in different modes please refer to the article PHP settings on CloudLinux.

Apache module

Details:

  • dynamic content is handled by the PHP module of the Apache web server;
  • PHP settings are specified globally and apply to all user sites with this mode. Settings can only be changed by an administrator in Web server settings → PHP → Extended settings;
  • you can only use a native PHP version of the module, which is applicable to all ispmanager users;
  • in terms of operation speed, is inferior to LSAPI and FastCGI (Nginx + PHP-FPM), but superior to CGI and FastCGI (Apache).

To activate the mode:

  1. Go to Accounts  → Users  → click Edit, navigate to the Access section and enable the option PHP as Apache module;
  2. Select the mode when creating or editing a website. Learn more in the article Add a website.

When this mode is activated, the following lines are added to the Apache configuration file for the site:

Apache configuration file

<FilesMatch "\.ph(p[3-5]?|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
<IfModule php5_module>
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f <administrator email>"
    php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
    php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
    php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php7_module>
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f <administrator email>"
    php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
    php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
    php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>

<IfModule php5_module>
    php_admin_flag engine on
</IfModule>
<IfModule php7_module>
    php_admin_flag engine on
</IfModule>

LSAPI

Details:

  • dynamic content is handled by the LSAPI module of the Apache web-server;
  • PHP settings are specified individually for each user. They can be changed by the user in WWW  PHP  Extended settings;
  • for each site running in this mode, you can select any PHP version from the list of installed alternative versions. The module runs on the native PHP version;
  • in terms of operation speed, is inferior only to FastCGI (Nginx + PHP-FPM). 

To activate the mode:

  1.  Select the “Prefork” mode for Apache. Refer to the article Istall a web server for details;
  2. Go to  Accounts  → Users  →  click Edit, navigate to the Access section and enable the option Can use PHP in LSAPI mode for Apache, then enable CageFS;
  3. Select the mode when creating or editing a website. Learn more in the article Add a website.

When this mode is activated, the following lines are added to the Apache configuration file for the site:

Apache configuration file

<FilesMatch "\.ph(p[3-5]?|tml)$">
    SetHandler application/x-lsphp72
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
<IfModule lsapi_module>
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f <administrator email>"
    php_admin_value upload_tmp_dir "/var/www/testa/data/mod-tmp"
    php_admin_value session.save_path "/var/www/testa/data/mod-tmp"
    php_admin_value open_basedir "/var/www/testa/data:."
</IfModule>

CGI

Details:

  • dynamic content is handled by Apache in CGI mode;
  • PHP settings are specified individually for each user. They can be changed by the user in WWW → PHP settings → Extended settings;
  • an ispmanager user can select the PHP version to be used for all their sites. This can be changed by the user in WWW → PHP;
  • the slowest operation mode.

To activate the mode:

  1. Go to Accounts  → Users  →  click Edit, navigate to the Access section, enable the option PHP as CGI and CageFS. Select the PHP version.
  2. Select the mode when creating or editing a website. Learn more in the article Add a website.  

When this mode is activated, the following lines are added to the Apache configuration file for the site:

Apache configuration file

<FilesMatch "\.ph(p[3-5]?|tml)$">
    SetHandler application/x-httpd-php5
</FilesMatch>
ScriptAlias /php-bin/ /var/www/php-bin-isp-php52/<WWW domain owner>/
AddHandler application/x-httpd-php5 .php .php3 .php4 .php5 .phtml
Action application/x-httpd-php5 /php-bin/php

FastCGI (Apache)

Details:

  • dynamic content is handled by Apache as FastCGI;
  • PHP settings are specified individually for each user. They can be changed by the user in WWW → PHP settings → Extended settings;
  • only the native PHP version of the module can be used, which is applicable to all ispmanager users;
  • in terms of operation speed, is superior to the CGI mode, but inferior to the Apache module and FastCGI (Nginx + PHP-FPM). 

To activate the mode:

  1. Select the “Prefork” mode for Apache. Refer to the article Istall a web server for details;  
  2. Go to Accounts  → Users  →  click Edit, navigate to the Access section, enable the option PHP as  FastCGI (Apache).
  3. Select the mode when creating or editing a website. Learn more in the article Add a website.

When this mode is activated, the following lines are added to the Apache configuration file for the site:

Apache configuration file

<FilesMatch "\.ph(p[3-5]?|tml)$">
    SetHandler fcgid-script
    FCGIWrapper /var/www/php-bin/<WWW domain owner>/php
</FilesMatch>

Options +ExecCGI

FastCGI (Nginx + PHP-FPM)

Details:

  • dynamic content is handled by PHP-FPM;
  • PHP settings are specified individually for each user. They can be changed by the user in WWW → PHP settings → Extended settings;  
  • only the native PHP version of the module can be used, which is applicable to all ispmanager users;
  • PHP-FPM doesn't support .htaccess rules;
  • the fastest mode. 

To activate the mode:

  1. Go to Accounts  → Users  →  click Edit, navigate to the Access section, enable the option PHP as FastCGI (Nginx + PHP-FPM).
  2. Select the mode when creating or editing a website. Learn more in the article Add a website.

When this mode is activated, the following lines are added to the Nginx configuration file for the site:

Nginx configuration file

location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f <administrator email>";
    fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;