Enabling Multiple PHP versions On DirectAdmin

It is convenient to have multiple PHPs in a server. DirectAdmin control panel has this feature available. With this, you can have legacy PHP versions to the latest stable versions. This will allow the server to support legacy software along with the latest software.

This can be achieved by using the CustomBuild tool which is the built-in tool which allows you to install, remove, and recompile programs from source. Since the installation requires the recompilation of the source code, it is advisable to take the backup of the server files. Make sure CustomBuild is updated to version 2.0.

1) Reconfiguring the CustomBuild 2.0 configuration

This can be done in two ways by directly accessing the configuration file of CustomBuild and editing the configuration file for the new configuration to take effect. The configuration file of CustomBuild is ‘options.conf’. The following commands will lead to the configuration file options.conf for editing the file.

#cd /usr/local/directadmin/custombuild

#vi options.conf

The alternate way of doing this is to use the command line method where specific scripts are used to change the configuration files. This method is safer as unnecessary errors in configuration syntax can be avoided. Run the following commands for changing the configuration file.

2) Choosing the PHP versions

#./build set php1_mode php-fpm

#./build set php2_mode php-fpm

#./build set php1_release 7.0

#./build set php2_release 5.6

These commands allow both PHP 7.0 and PHP 5.6 on the server and php-fpm. PHP-fpm must be selected while using Nginx and Apache reverse proxy. If you are not using the reverse proxy set up, php mode can be changed. If you need to verify these changes ,you can view it in the options.conf file.

Be sure to use PHP versions above 5.6. Older versions have reached end of life and are not maintained and updated.

3) Recompiling the updated configurations

Now we have changed the configuration and need to recompile the PHP. You need to rewrite the configurations for the new configurations to take effect. The following commands will do the same.

#./build php n

#./build rewrite_confs

Since this process can take time run these commands in screen. This prevents network failure from interrupting this process.

4) Configuring PHP versions for Websites

Now it’s time to select the PHP version for individual websites.

Enable Multiphp

In order to alter the PHP version of websites navigate to the user level, select the domain name, click ‘Domain Setup’ under the account you have. Now choose the domain name and click on it. Scroll down to change the PHP version. There will be a delay of a few minutes to process the changes as it requires a webserver restart.

If you need any further assistance please contact our support department.

 2,413 total views,  3 views today


So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *