0

Both my valet and composer is using php 8.0 But my local says

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.30. in /Users/admin/sites/sage10/web/app/themes/sage10/vendor/composer/platform_check.php on line 24

When I upgrade php with valet using 8.0 it gives

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/admin/.composer/vendor/illuminate/container/Container.php

But at the end it says its using 8.0. and composer -vvv about also gives php 8.0

Is there more things to consider? I don't understand why its saying I'm using 7.4...

Justina
  • 1
  • 1
  • "it gives" - who is it? Which version of these global packages do you use? – Nico Haase Oct 12 '22 at 10:27
  • It seems as my valet and php version is not linked. When I change php version using valet it shows different version when I type php -v. ex) Valet is now using php@7.4. PHP 8.0.24 (cli) (built: Sep 30 2022 09:37:04) ( NTS ) – Justina Oct 12 '22 at 12:08

2 Answers2

0

Composer works on the php version is in use on command line. It is possible you have multiple version installed. Try to run

php -v

Then ensure composer is updated to the latest version (2.4.2)

composer -V

In case update it

composer self-update

If self-update gives you some runtime error, reinstall composer following the install procedure

Then the error you get is about Laravel 6/7/8 version with PHP 8, the solution is here

Laravel app stopped working after upgrading to php 8

Roberto Braga
  • 569
  • 3
  • 8
  • php -v shows that I'm using 8.0 and composer, brew is already updated to the latest. I tried the solution already but its not working. I thought when changing php versions with valet you just need to type valet use php@x.x. and it will automatically change. In my case it only works when I use php 7.4 with valet. When I use 8.0 with valet, it gives the error. Do you have other suggestions? – Justina Oct 12 '22 at 11:41
  • I think from that solution is missing to remove composer.lock this file helds the installed version and prevent installing different version in order to resolve version conflict. Just in case, rename it to composer.lock , put as php version 8.0 in composer.json and do composer install again. This should install different version of packages accordingly to the php version installed on the system – Roberto Braga Oct 12 '22 at 12:02
  • Yeah! Similar to what you said I updated my composer global file after erasing a line of code inside .composer file. I had a line inside that was not needed! After erasing that line(illuminate/support) and updating global composer it started to work without any errors. Also I had to link my valet with my php database. :)) Thank you for your help. – Justina Oct 12 '22 at 12:53
0

I had a line of required package that was not needed and supported with sage 10// php8 (illuminate/support) inside my global composer file. After erasing that and linking my valet with php database and restarting it, everything started to work.

Justina
  • 1
  • 1