1

I've tried several attempts and the results are all unsuccessful. composer says my php version is 7.3 but i am already installing php 8.0.2

I've seen some posts in the same situation as me, but it didn't solve anything at all.

this is my test server error code

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.23. in /home/vagrant/code/interproindigo/vendor/composer/platform_check.php on line 24

But when I run php -v, the php version is 8.0.9 as follows

PHP 8.0.9 (cli) (built: Jul 30 2021 13:03:39) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.9, Copyright (c) Zend Technologies with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies

How can I solve this problem?

Bolt
  • 11
  • 1
  • do you use Linux? do you have PHP 8.0 installed? – Vaso Gamdelidze Jul 28 '22 at 07:06
  • If you are using Linux and have PHP 8.0 in your device, run: sudo update-alternatives --config php, and then choose PHP 8.0 – Vaso Gamdelidze Jul 28 '22 at 07:08
  • Given that your projects seems to run in vagrant, are you sure the two commands are run in the same environment? If you run the `php -v` on your machine and composer in vagrant (or vice-versa) this could explain it. – Noah Boegli Jul 28 '22 at 07:08
  • sudo update-alternatives --config php did not solve it, and when I input the php -v command on the real server, `PHP 7.4.29 (cli) (built: Apr 12 2022 10:55:38) ( NTS )` is displayed. – Bolt Jul 28 '22 at 07:20

1 Answers1

0

The problem occurred because the php version of the real server and the test server did not match. php7.4 -f /usr/local/bin/composer update Entering this code solved the problem.

Bolt
  • 11
  • 1