Article overview

Help article

DirectAdmin: I want to upgrade the PHP version

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.

  • These steps require at least 512MB of free RAM. You can for example use the top command to check if you have enough free RAM.
     
  • 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
 

Step 1

Log into the VPS console or use SSH as a root-user.


 

Step 2

Navigate to the custombuild folder on the VPS:

cd /usr/local/directadmin/custombuild

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):

./build version

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 3

Enter the following commands to update PHP to version 7.3 and 7.2. PHP-FPM is a faster implementation of fast-cgi that'll improve website performance when handling large amounts of customers.

  • You can choose to support up to 4 PHP versions at the same time. Would you like to support one version? Configure it in php1_release and set the other phpX_release values to no. Would you like to support more versions? Then add php3_release and or php4_release.
     
  • At the time of this update, only PHP 7.3 and 7.2 receive security updates. We recommend not supporting older versions on your VPS.
./build set php1_release 7.3
./build set php2_release 7.2
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set mod_ruid2 no
./build php n./build rewrite_confs
  • 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'.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.