Our preinstalled version of DirectAdmin comes with CentOS as the underlying OS. By default CentOS uses some older versions of software (although updated with the latest security updates) because it prefers stability above the latest features. This is also the reason that the default PHP version is usually a few versions behind on what is available. If you want to use PHP 7 for example, you will first need to update the PHP version on your VPS.
- It is not without risk to update the PHP version on your VPS. You are advised to always create a snapshot before performing below commands in case something goes wrong.
- Is is not possible to update PHP through the regular command of yum update. The package for PHP are deliberately kept outsides of the default 'yum repository' by DirectAdmin. You therefore always need to use DirectAdmins custombuild software to update PHP.
- You can always check the current installed version of PHP by running the command php -v.
- There is a plugin available for custombuild so you can manage and update settings and versions from DirectAdmin itself.
So how do I use custombuild to update PHP?
Step 1: Checking the custombuild version
- Log into the console in the control panel or use SSH as a root-user.
- Navigate to the custombuild folder on the VPS:
- Check if you are already using version 2.0 of custombuild. This can be done by executing the following command (when in the correct folder):
- If you are still using an older version, you can upgrade the version to 2.0 by entering the following commands:
cd /usr/local/directadmin mv custombuild custombuild_1.x wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz tar xvzf custombuild.tar.gz cd custombuild
Step 2: Updating PHP
- Enter the following commands to update PHP to version 7.0 (you can also replace 7.0 by 5.6 or 7.1, etc. - lower then version 5.3 is not available):
./build set php1_release 7.0 ./build update ./build php d
- You can check the current versions of all installed (where applicable) software within custombuild by running the command:
- You can also update to the latest version for all available software by running:
- Apache should automatically restart after updating, but if this does not happen you need to manually reboot Apache. There are a lot of available command to do so, like /sbin/service httpd restart.
Tip! There is a plugin available for DirectAdmin which you can use to update / manage the PHP version from within DirectAdmin itself. To install this go to the Plugin Manager (Admin Level) in DirectAdmin and enter the following location in the 'URL' field: http://www.custombuild.eu/plugin/custombuild.tar.gz. Select Add Plugin and the installation starts. After this is finished you can use the plugin under the 'Extra Features' section.