How to manage the PHP version in cPanel using the Select PHP Version tool
Knowledgebase Article
}
Knowledgebase Article
Select PHP Version or the PHP Selector enables each user on the server to have its own, fully customisable and flexible PHP environment.
It allows users to switch between different PHP Versions, such as PHP 7.4, PHP 8.0, PHP 8.1, PHP 8.2, PHP 8.3, as well as enable more than 120 PHP extensions and modules, like APC, MySQLi, GD, PDO, SOAP, and others, entirely based on the user's needs.
Important: Changing the PHP version via cPanel applies to your entire account. If you need to set different PHP versions for different folders, subdomains, or addon domains, refer to our guide on Setting PHP Versions Per Folder / Website Using .htaccess.
Log into cPanel Login to your cPanel.
Click on the Select PHP Version tool under Software:

Select the desired PHP version from the drop-down list, but do not click Set as current yet:

That's it! The new PHP version is already enabled for your account.
Ensure OpCache is Enabled:
We strongly recommend enabling the OpCache extension for improved PHP performance. If this option is unchecked, your site may run slower than expected. Before applying changes, verify that OpCache is enabled in your PHP configuration.
If you want to enable or disable a PHP module, just select or deselect it from the list. Changes take effect immediately—there is no need to press Save.
You can also change PHP settings by clicking on the Switch To PHP Options button:

Here you can manage PHP options such as allow_url_fopen, max_execution_time, memory_limit, upload_max_filesize, and others:

Make sure to click on the Save button at the bottom to save your configuration!
The following outlines more information on what some of the PHP options available to you do, and some recommendations.
max_execution_time – Controls how long a script is allowed to run before timing out. A typical value is 30 or 60, but higher values may be needed for long-running tasks like imports or backups.memory_limit – Defines how much memory a PHP process can use. Do not set this too high. If your plan has 1GB RAM, setting this to 1G means a single PHP process could consume all available memory. Set this as low as possible while ensuring your application runs correctly, typically 128M to 256M.realpath_cache_ttl – Controls how long realpath cache entries are stored. A higher value like 7200 (2 hours) can improve performance for sites with many file operations.realpath_cache_size – Defines the realpath cache size. Setting this to 4096K is generally recommended for optimal performance.PHP Memory for CLI / Cron Jobs
Note, when setting PHP memory limits, you want to set this limit only as high as is necessary for web based PHP executions. Command-line and cron jobs can be executed with a higher memory limit without increasing the web memory limit.
Instead of setting memory_limit high globally, use the PHP_MEMORY_LIMIT flag in your commandline executions or cron jobs:
allow_url_fopen – Allows PHP to fetch external URLs via file_get_contents() and similar functions. Enable only if necessary, as it can be a security risk.expose_php – Determines whether PHP exposes its version in HTTP headers. Set this to Off to prevent attackers from identifying PHP vulnerabilities.open_basedir – Restricts PHP scripts to specific directories, preventing access to files outside the web root.session.save_path – Defines where PHP stores session files. This should typically be left as default: /opt/alt/phpXX/var/lib/php/session.file_uploads – Controls whether PHP allows file uploads. Ensure this is On if your site accepts user-uploaded files.upload_max_filesize – Sets the maximum file upload size. Increase this if users have trouble uploading large files (e.g., 128M).post_max_size – Defines the maximum size of POST data, including file uploads. This must be equal to or larger than upload_max_filesize.upload_tmp_dir – Temporary directory for file uploads. Leave as default unless required.display_errors – Controls whether PHP errors are displayed in the browser. Set this to Off in production for security. Enable only for debugging.log_errors – Logs errors to a PHP error log file. By default, this logs errors in a error_log file in the root folder of your application (e.g., public_html for main sites, or the folder of an addon/subdomain).error_reporting – Controls which errors are logged. A common setting is E_ALL & ~E_NOTICE & ~E_DEPRECATED, which logs critical issues but ignores minor notices.short_open_tag – Allows the use of <? instead of <?php. Best practice is to keep this Off unless required by legacy scripts.include_path – Defines search paths for included files. Typically remains default unless required.đź’ˇ Tip: If you're unsure about a setting, click Reset to default to revert to recommended values.
Important Warnings:
Powered by WHMCompleteSolution