Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default version of Php in CentOS 7

I have two versions of PHP in opt/remi folder php56 and php72 but when I php -v on cmd it shows:

Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

How to set default version to PHP 7.2?

like image 339
ata Avatar asked Jul 17 '18 09:07

ata


2 Answers

I have two versions of PHP in opt/remi folder php56 and php72

how to set default version to PHP 7.2

SCL are designed for parallel installation so don't alter default version in base system

Once the collection is enabled, the version will be used

$ scl enable php72 bash
$ php -v
PHP 7.2.8 (cli) (built: Jul 17 2018 05:35:43) ( NTS )

If you want 7.2 to be the default version (base system) you should install it, according to Wizard instructions for "Default / single version" (and keep 5.6 as secondary version)

like image 191
Remi Collet Avatar answered Sep 19 '22 13:09

Remi Collet


Change php cli version in Centos 7

First, find your php7, run phpinfo() and get path or you can do with other ways. for me, it is:

/usr/local/lsws/lsphp73/

then:

cd ~
. ~/.bash_profile

And:

alias php='/usr/local/lsws/lsphp73/bin/php'

Now:

php -v

PHP 7.3.13 (cli) (built: Dec 20 2019 16:02:35) ( NTS )

like image 22
Pedram Avatar answered Sep 20 '22 13:09

Pedram