PHP is one of the most popular scripting languages for creating dynamic web pages. The majority of today's websites and web applications are based on PHP scripts. This is why site administrators should clearly understand how they can control the execution of PHP scripts.
How PHP scripts are executed for a certain website is fully defined by two aspects: PHP handler and PHP settings for the site. You can set up these parameters for a certain website in the Control Panel as described below.
Note: PHP shipped with Plesk comes with the IonCube loader pre-installed.
When a visitor accesses a site based on PHP scripts, a web server interprets site scripts to generate a page that will be shown to the visitor. PHP handler calls PHP libraries needed for this interpretation. You can choose from a number of PHP handlers: ISAPI (Windows), Apache module (Linux), FastCGI, CGI, or PHP-FPM (Linux). The decision on what PHP handler to choose should depend on a number of factors like security considerations, script execution speed, and memory consumption.
To choose a PHP handler for your website:
Run PHP as |
Performance |
Memory Usage |
Security |
Apache module (Linux only) |
High. Runs as a part of the Apache web server. |
Low |
This handler (also known as mod_php) is the least secure option as all PHP scripts are executed on behalf of the Note: You can alleviate some security issues by turning the PHP safe_mode option on. It disables a number of PHP functions that bring potential security risk. Note that this may lead to inoperability of some web apps. The safe_mode option is considered to be obsolete and is deprecated in PHP 5.3. |
ISAPI extension (Windows only, not supported since PHP 5.3) |
High. Runs as a part of the IIS web server. |
Low |
The ISAPI extension can provide site isolation in case a dedicated IIS application pool is switched on for subscriptions. Site isolation means that sites of different customers run their scripts independently. Thus, an error in one PHP script does not affect the work of other scripts. In addition, PHP scripts run on behalf of a system user associated with a hosting account. Note: The ISAPI extension handler is not supported since PHP 5.3. |
CGI application |
Low. |
Low |
The CGI handler provides PHP script execution on behalf of a system user associated with a hosting account. On Linux, this behavior is possible only when the suEXEC module of the Apache web server is on (the default option). Otherwise, all PHP scripts are executed on behalf of the We recommend that you use the CGI handler only as a fall-back. |
FastCGI application |
High (close to Apache module and ISAPI extension). Keeps the processes running to handle further incoming requests. |
High |
The FastCGI handler runs PHP scripts on behalf of a system user associated with a hosting account. |
PHP-FPM application (Linux only) |
High |
Low |
The PHP-FPM is an advanced version of FastCGI which offers significant benefits for highly loaded web applications. The PHP-FPM handler is available only if it was installed by the hosting provider and if the option Process PHP by nginx in the website’s settings is turned on (Websites & Domains > select a domain > Web Server Settings). |
Note: Switching PHP from Apache module to FastCGI application may disrupt the operation of existing PHP scripts. Switching to PHP-FPM by selecting Process PHP by nginx in the website’s web server settings may do the same.
Plesk supports different versions of PHP. For each handler, one or more PHP versions can be available. To select the PHP version for a website, go to Websites & Domains > Hosting Settings and select the desired PHP version from the PHP version menu. If the desired PHP version is missing from the list, contact your hosting provider.
Note: Always use PHP 5.x except for the cases when you need PHP 4.x to host some old PHP apps.
The processing of PHP scripts depends on several configuration settings. These settings specify various script execution aspects, like performance (for example, the amount of memory a script can use), security (for example, access to file system and services), and so on. You may need to adjust these settings for a number of reasons:
PHP settings are located in the Control Panel, Websites & Domains > select a website > PHP Settings. For convenience, all PHP settings are divided into two groups:
memory_limit parameter to limit the amount of memory for a script to prevent a memory leak. In addition, you can prevent scripts from tying up the server by limiting the maximum time scripts are allowed to run using max_execution_time.You can set the value of each parameter in PHP Settings either by selecting a value from a preset, typing a custom value, or leaving the Default value. In the latter case, Plesk uses the values defined by the server-wide php.ini file. For information about certain PHP settings, refer to the respective documentation. For example, http://php.net/manual/en/ini.list.php.
It is possible to use three placeholders in parameter values:
{DOCROOT} for the document root directory of a domain that gets custom PHP configuration.{WEBSPACEROOT} for the root directory of a subscription (webspace).{TMP} for the directory which stores temporary files.Note: Default values of PHP settings in Plesk differ from the ones suggested by the official PHP documentation at http://php.net/manual/en/ini.list.php.
Note: Custom PHP configuration of a website acts as a preset for all subdomains of this site. You can perform further per-subdomain PHP configuration in the same way as for the websites.