Skip to main content

How to change a PHP mode

Introduction

FASTPANEL® allows to select one of four different PHP modes for each website individually. They are:

  • PHP as an Apache module
  • PHP-FPM
  • FCGI
  • CGI

To choose PHP mode, open "Settings" menu in the Site card. Please note that using any mode different from "Apache module" allows you to use an alternative PHP version if it is installed on the panel.

Which mode is better to choose?

  • If the website does not use the .htacess file, then you should select the PHP-FPM mode.
  • If the website uses the .htacess file and the main PHP version is suitable, then you should select the Apache module.
  • If the website uses the .htacess file and the alternative PHP version is required, then you should select the FastCGI mode.
  • CGI mode is better to be used as the last option if for some particular reason the website doesn’t work properly in the other modes.

Let's take a closer look at each mode.

PHP as Apache module

This mode uses a system-default PHP version. In this case Nginx is used as a Frontend server, and Apache - as a Backend one (scripts are processed by the mod_php module). Apache operates in MPM ITK mode which allows each website to operate under a separate user.

FastCGI

This mode allows switching between PHP versions. In this case Nginx is used as a Frontend server, and Apache - as a Backend one (scripts are processed by the mod_fcgid module). In FastCGI case processes are being kept in the server memory and process several requests which speeds up PHP scripts processing which, in turn, affects a site working speed. It is recommended to use this mode when an alternative PHP version is used.

PHP-FPM

This mode allows switching between PHP versions. In this case PHP-FPM is used as a Backend server and Nginx stays as a Frontend one. It is important to keep in mind that in this mode .htaccess files cannot be processed and all .htaccess settings have to be converted into Nginx configuration.

CGI

This mode allows switching between PHP versions. Apache operates as a Backend server and creates a separate PHP process for each request.