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.2 for example, you will first need to upgrade 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
Using custombuild to upgrade PHP
Navigate to the custombuild folder on the VPS:
Are you using DirectAdmin 1.5 or newer? Skip ahead to step 3.
Check if you are already using version 2.0 of custombuild (requires DirectAdmin 1.46+). 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
Enter the following commands to update PHP to version 7.2 (you can also replace 7.2 by 7.1, 7.0 and earlier receive no security updates as of november 2018):
./build set php1_release 7.2
./build php n
- Apache should automatically restart after updating, but if this does not happen you need to manually reboot Apache:
systemctl restart httpd
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.
This concludes this article. For more information about updating DirectAdmin, consult the update section of our DirectAdmin tutorial series.
Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach us via the ‘Contact Us’ button at the bottom of this page.
If you want to discuss this article with other users, please leave a message under 'Comments'.