Learn to change PHP version in DirectAdmin, One of the problems that web server administrators face is changing the PHP version of the DirectAdmin. Today we’re going to teach you how to change the version of PHP used on your DirectAdmin server. Stay with us.
Learn to change PHP version in DirectAdmin
Using multiple versions of PHP at the same time in the DirectAdmin:
DirectAdmin supports launching multiple versions of PHP together. Currently, the most common combination of PHP is 5.6 and 7.
In this tutorial, we will use “CustomBuild” to launch two versions of PHP. Before you begin training, you need to make sure your server uses CustomBuild 2.0. Otherwise, you have to update it.
Note:DirectAdmin supports version 1.50.1 and later PHP version 7.
Change to CustomBuild Configuration:
There are two ways to change the CustomBuild configuration: make changes to the “options.conf” file or use the codes we make here by modifying the codes. To configure two versions of PHP 5.6 and 7, go to the CustomBuild folder first.
Configure PHP versions:
Use the following command to customize the versions:
A) ./build set php1_mode PHP-fpm
B) ./build set php2_mode PHP-fpm
C) ./build set php1_release 7.0
D) ./build set php2_release 5.6
Using the above command, both versions of PHP are launched in the “PHP-fpm” mode.
This is essential if you are using “Nginx” and “Apache reverse proxy”.
If you don’t use a reverse proxy, you can change the PHP mode if necessary.
The use of PHP versions older than 5.6 is not recommended as they have reached the end of their life, so they are not updated. As such, it is recommended that you use PHP 7 if possible and only use version 5.6 for temporary support of older applications.
Open the “options.conf” file:
Some basic lines to see in the file:
If you do not see the above, rent the order again.
Step Three: Recompile PHP:
Overwrite and Recompile PHP Settings:
./build php n
Step 4: Configure PHP versions:This may take some time, please do not disconnect at all. It is best to put the server on “screen session“ before starting this process so that your system or “SSH” is not interrupted.
You will now be able to select the desired PHP version on the sites hosted on this server. Any website that has a DirectAdmin value set to “php1_release” can use this feature. To change the PHP version for each website, go to “User Level”, select the domain name you want, under “Domain Setup“, click “Your Account“, select the domain name you want to scroll down. You can now select your PHP version.
Note: that after the version changes, the relative processing time of the changes will be 1 minute.