How to update php cli in DirectAdmin

Check the current version PHP CLI version in shell

[root@server custombuild]# php -v
PHP 7.1.33 (cli) (built: Apr 22 2020 20:24:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

From the official DirectAdmin help page ,https://help.directadmin.com/item.php?id=2094 the way to install multiple version of PHP in the machine.

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs

Set the php1_release to the version

The version to set as the php1_release will be the version in CLI

You may modify the /usr/local/directadmin/custombuild/options.conf

vim /usr/local/directadmin/custombuild

#PHP Settings
php1_release=7.3
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm
php3_release=7.1
php3_mode=php-fpm
php4_release=7.0
php4_mode=php-fpm

Re-compile all the PHP versions

./build php n
./build rewrite_confs

Now you can check the version you need in the console

[root@server custombuild]# php -v
PHP 7.3.17 (cli) (built: Apr 22 2020 21:24:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.17, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.
    with Zend OPcache v7.3.17, Copyright (c) 1999-2018, by Zend Technologies

Tags:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.