Centos设置默认PHP版本
使用Composer install 命令时,出现提示:Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.1.33, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.
# 1. 查找PHP安装目录
[root@centos]# find / -name php
/www/server/panel/install/php
/www/server/php
/www/server/php/72/include/php
/www/server/php/72/php
/www/server/php/72/php/php
/www/server/php/72/bin/php
/www/server/php/72/lib/php
/www/server/php/74/include/php
/www/server/php/74/php
/www/server/php/74/php/php
/www/server/php/74/bin/php
/www/server/php/74/lib/php
/www/server/php/56/include/php
/www/server/php/56/php
/www/server/php/56/php/php
/www/server/php/56/bin/php
/www/server/php/56/lib/php
/www/server/php/70/include/php
/www/server/php/70/php
/www/server/php/70/php/php
/www/server/php/70/bin/php
/www/server/php/70/lib/php
/www/server/php/71/include/php
/www/server/php/71/php
/www/server/php/71/php/php
/www/server/php/71/bin/php
/www/server/php/71/lib/php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 2. 删除既有环境
[root@centos bin]# php -v
PHP 7.0.33 (cli) (built: May 13 2020 15:56:42) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
[root@centos bin]# rm -f /usr/bin/php
1
2
3
4
5
6
2
3
4
5
6
# 3. 设置默认PHP版本
[root@centos bin]# ln -sf /www/server/php/74/bin/php /usr/bin/php
[root@centos bin]# php -v
PHP 7.4.33 (cli) (built: Nov 9 2022 15:05:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
1
2
3
4
5
2
3
4
5
上次更新: 2023/09/16, 02:28:15