How to select PHP version, extensions and ini settings
This article was posted in: Web Hosting
Krystal offer customers considerable flexibility when it comes to the configuration of PHP - the popular server-side scripting language. We support a broad range of PHP versions from 5.2, including 7.x, and an even broader array of extensions, and php.ini settings.
Selecting unnecessary PHP extensions to load at run-time can adversely affect the performance of your website because the server has to open more files in order to process your scripts.
However, this functionality should be used with care. Selecting incompatible extensions (for example, the apc extension should not be used with PHP 5.4 and above) can cause intermittent or permanent errors or performance degradation.
Conversely, failing to select PHP extensions that are required by your web application can cause server errors and prevent it from working at all.
What is a PHP extension? A PHP extension, as its name suggests, extends the PHP language with more functions. For example, the mcrypt extension provides a range of PHP functions relating to cryptography. If you attempt to use any of these functions without activating this extension when your pages will return an internal server error.
For example, Magento has a list of required PHP Extensions listed including mcrypt, and DOM, which may not be enabled by default for your account. This guide will show you how to enable those extensions and more.
This guide assumes you are already logged into your cPanel account.
NOTE: Please avoid using the Native version of PHP as this is manually compiled and has restricted functionality.
Locating the PHP settings configurator in cPanel
From the cPanel main page, locate the Software group and click on the Select PHP Version icon.
How to select the desired version of PHP
The Select PHP Version icon will link to the Current PHP version selection screen.
- Click on the PHP Version drop-down control to select from the available versions of PHP installed on the server. This selection affects your entire cPanel account - you cannot operate different versions of PHP for different addon/sub-domains or directories.
- You MUST click the Set as current button to activate any changes.
The native version of PHP (which may not necessarily be 5.4 as shown here) is simply a default installation of PHP provided by cPanel, which appears only for legacy reasons, and should not be selected as it offers no configuration options, and may not function correctly at times.
How to select the desired PHP extensions
For each version of PHP in the drop-down list, cPanel remembers which selection of extensions are enabled - so be careful when switching versions to ensure your required extensions are enabled (and only those).
To enable or disable individual extensions simply check/uncheck the boxes as required and then be sure to remember to click the Save button at the bottom.
How to alter the php.ini settings for your account
In the top right of the Current PHP version screen, click on the Switch to PHP Options link. The subsequent screen will allow you to alter some common php.ini settings. To alter any of the individual settings, click on the setting value itself, and enter the preferred value. Again, the settings for each version of PHP are remembered, so be careful when switching PHP versions.
- In the example shown, the number 120 was clicked upon to enable the setting to be changed.
- Be sure to Apply the change to confirm it.
- And finally, don't forget to click the Save button at the bottom to activate the new settings.
IMPORTANT SECURITY NOTE : To avoid compromising security, disable_functions should only be changed with caution and only if you are sure of what you are doing. Modern PHP web applications intended for shared hosting environments are unlikely to need any adjustments to this setting. Please ask for advice if you are unsure.
If you require further customisation of your PHP environment, please raise a support ticket.