Multiple PHP Versions in CloudLinux

Multiple PHP Versions in CloudLinux

Posted 21st January 2016 by Lee

CloudLinux has the ability to provide end users with Multiple PHP Versions. This feature know as ALT-PHP has been available for sometime in releases of CloudLinux, yet many users are unaware of it’s capabilities and options it offers. Why is the ability to choose from Multiple PHP versions important? Well, that’s a good question…

Why use multiple PHP versions?

Pre-CloudLinux, to use a newer or even older version of PHP you had to ask your hosting provider to place you on a different server with the specified PHP version installed. This was a timely procedure, both for the hosting company and yourself, and normally meant some downtime while the host moved your account. This is no longer the case, as from a simple dropdown menu, you can now choose your PHP Version which your script requires.

While we wouldn’t recommend using an older version just because it’s there – some scripts will require certain PHP functions which are “depreciated” in newer versions of PHP. The PHP selector will allow you to choose these older versions (or newer versions) than the default version on the server. It’s important to keep software up-to-date, however some older custom coded scripts may require an older version of PHP as they will not be maintained as much as they would if they were opensource/readily available scripts such as WordPress for example.

How do I change my PHP version?

In order to change your PHP version, first you will need to login to cPanel. Navigate to the “Select PHP Version” option. This is found under “Software” in the Paper Lantern theme.

php selector

Once you have selected this, you will see some more options. By default, your PHP selector will be set to native (5.4). To change this, you can select from the dropdown menu another version, such as 5.5 for example and then press “Set as current”. When you do this, you will be presented with a list of PHP modules as shown below…

php modules selector

Enabling a PHP module

So you’ve just installed a script and you find out you need to enable json for it to work correctly? Great. If you head over to the PHP selector as before – change your version from the native version, you can then manage the PHP modules which are available for use on your account. If you require json – tick the box, press save and this will update. You’ll see a message “module set saved” pop up, and then it should be good to go.

Editing PHP.ini options

Another awesome feature of CloudLinux’s ALT-PHP module is the PHP.ini section. At the top of the PHP selector, if you click the link ‘Switch to PHP Options’ you will see the following (dependent on PHP version, you may see more/less options – the example below is of PHP 5.4).

phpini options

In this example above, we’ve changed the max_execution_time, memory_limit, post_max_size and upload_max_size. These all take effect via the PHP Selector rather than using a PHP.ini file, you can set it using the CloudLinux ALT-PHP UI. Great isn’t it?

Hit us up on Twitter or Facebook and let us know if this was helpful info (or not)! We really do appreciate your feedback!

Categories: Web Hosting

You may also like...