Once in a while, there is a new version of PHP. When this happens, it’s better to change your version of PHP to the most updated one. This has different reasons that we will explain them shortly:
Outdated versions: When a new version of PHP gets released, after a while the older versions become outdated and won’t work anymore.
Better security: Updated versions of PHP have better security.
Plug-ins and modules: Some plug-ins and modules won’t work on the old PHP versions.
Now that you know the reasons, Let’s see how you should change your PHP versions.
If you have Cpanel as control panel:
this process is much easier for you. Cpanel has a lot of benefits that here is one of them: supporting multi versions of PHP. This means that by default, Cpanel gives you this option to change your PHP version in its area. So, all you have to do is: go to “Select PHP version” section (if Cloudlinux is installed on your sever) or “Multi PHP manager” (if Cloudlinux isn’t installed on your server) and change your PHP version.
If you have Direct Admin as control panel:
Direct admin doesn’t have the same option as Cpanel does. Direct admin doesn’t let you easily change your PHP version in its area. That’s why you can only change PHP version in your direct admin, by using SSH (Remote Access). This means that you have to have root access for this. You have root access for dedicated servers and VPS. If your server is shared hosting, because you are sharing that server, you can’t have root access.
- Have a full backup of your data.
- Connect to SSH by using putty software and your server’s IP.
- Login with the root account.
- Now copy and paste each of these commands in turn and press enter after each of them.
(Remember to replace the *current PHP version* and *New PHP version* with correct versions.)
nano options.conf php1_release=*current PHP version* php2_release=*New PHP version* ./build php n
Now that the needed PHP versions are added, you can change it in domain setup section of your direct admin.
Direct admin can only support maximum number of two PHP versions. If you have 2 PHP versions on it, you’ll see this in Domain setup section.
If you enjoyed this post, take a look at other posts on our Blog.