Set default version of Php in CentOS 7

Thank you for reading this post, don't forget to subscribe!

在一個系統裡有兩個以上的php版本

執行了php -v 後發現

PHP 5.6.40 (cli) (built: May 13 2020 15:59:55)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans

怎麼是5.6.40版 想要改成7.x.xx版 怎麼做……

cd /usr/bin

ls php* -l

可以看到php的軟連結是

只要

unlink php

ln -s /www/server/php/74/bin/php php

php -v

PHP 7.3.23 (cli) (built: Oct 27 2020 16:41:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.23, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v3.0.0, Copyright (c) 2002-2020, by Derick Rethans