美文网首页
宝塔php多版本切换默认版本笔记!

宝塔php多版本切换默认版本笔记!

作者: DragonersLi | 来源:发表于2021-09-06 15:56 被阅读0次

项目目录执行composer update -vvv报错:说当前php版本5.4.16不满足要求。可是当前项目用的是7.4版本,之前装过多版本,现在只有一个版本。却不是默认版本。
根据报错信息PHP Warning: Unsupported declare 'strict_types' in ...查询:
PHP强类型是从PHP 7.0开始支持的,如果PHP版本低于7.0.0,会报错Warning: Unsupported declare 'strict_types' in ...

 composer update -vvv
PHP Warning:  putenv() has been disabled for security reasons in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 93

Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 93
PHP Warning:  putenv() has been disabled for security reasons in phar:///usr/bin/composer/src/Composer/Util/Platform.php on line 37

Warning: putenv() has been disabled for security reasons in phar:///usr/bin/composer/src/Composer/Util/Platform.php on line 37
PHP Warning:  Unsupported declare 'strict_types' in /www/wwwroot/test.pjinhua.com/vendor/easywechat-composer/easywechat-composer/src/Plugin.php on line 3

....


Dependency resolution completed in 0.005 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=7.1.0 but your PHP version (5.4.16) does not satisfy that requirement.

更改当前默认PHP版本: ln -sf /www/server/php/74/bin/php /usr/bin/php 指定默认版本

[root@test new.test.com]# php -v  #查看当前版本
PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@test new.test.com]# ls -l /usr/bin/php  #查看默认使用版本
-rwxr-xr-x 1 root root 4618080 Apr  1  2020 /usr/bin/php
[root@test new.test.com]# ln -sf /www/server/php/74/bin/php /usr/bin/php #指定默认版本    
[root@test new.test.com]# ls -l /usr/bin/php #查看默认使用版本
lrwxrwxrwx 1 root root 26 Sep  6 15:37 /usr/bin/php -> /www/server/php/74/bin/php
[root@test new.test.com]# php -v #查看当前版本
PHP 7.4.8 (cli) (built: Jul 10 2020 17:03:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
[root@test new.test.com]# 

相关文章

网友评论

      本文标题:宝塔php多版本切换默认版本笔记!

      本文链接:https://www.haomeiwen.com/subject/lpvarxtx.html