How do I set the PHP version, extensions and options in cPanel?
To change the current PHP version used by your website:
Log into cPanel.
In the Software section, click on Select PHP Version.
On the PHP Selector page, you will see the current PHP version.
Click the dropdown next to the Current PHP Version.
Select the PHP version you want to use from the list (e.g., PHP 7.4, PHP 8.2).
Click Set as current to apply the changes.
This will change the default PHP version for your account. Make sure that your website and applications are compatible with the PHP version you are switching to.
To enable or disable specific PHP extensions:
Log into cPanel.
In the Software section, click on Select PHP Version.
On the PHP Selector page, you’ll see a list of PHP extensions below the version selector.
Check the boxes next to the extensions you want to enable, or uncheck the boxes next to the extensions you want to disable.
Once you’re done selecting the extensions, the changes are saved automatically.
To adjust PHP options like maximum file upload size, execution time, and more:
Log into cPanel.
In the Software section, click on Select PHP Version.
Once on the PHP Selector page, click on the Options tab at the top.
You’ll see a list of PHP options with their current values. Some common options include:
upload_max_filesize: Sets the maximum size for uploaded files.
post_max_size: Maximum size of POST data (includes file uploads).
max_execution_time: Time limit in seconds before a script is terminated.
memory_limit: Maximum memory allocated for PHP scripts.
Click on the values next to each option to change them as needed.
The changes are saved automatically once you modify the values.
To set the PHP version for a specific folder:
It is possible to use multiple PHP versions within a single cPanel account. This is particularly useful for testing applications or managing upgrades. This is achieved by modifying the .htaccess file within the folder.
Add the following line to the .htaccess file:
AddType application/x-httpd-alt-php74 .php
Replace php74 with the desired PHP version (e.g., php81, php83, etc.). This change will apply the specified PHP version to all .php files within the folder.
Updated on: 21/11/2024
Thank you!