vincej's avatar
Level 15

Composer refuses to upgrade PHP version to 8

So, all I have done in my attempt to upgrade is to change my composer.json file to

 "require": {
        "php": "^8.0.0",

I get an error message:

  Problem 1                                                                                                                                
    - laravel/framework[v8.12.0, ..., 8.x-dev] require php ^7.3|^8.0 -> your php version (7.2.19) does not satisfy that requirement.       
    - laravel/framework[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (7.2.19) does not satisfy that requirement.             
    - Root composer.json requires laravel/framework ^8.0.0 -> satisfiable by laravel/framework[v8.0.0, ..., 8.x-dev].                      
                                                                                                                                           
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. 
                                                                                                                                           

Ok, so I tried using composer update -W as suggested and simply got the same error.

So, what gives, usually, composer update just works fine.

Thanks !

0 likes
5 replies
jlrdw's avatar

You need to install PHP 8 I don't think composer is going to do that for you. It's just checking the requirements.

Sinnbeck's avatar

All you are doing is telling composer that your app requires php 8. But you system is still running php 7.2

If you are on linux

sudo apt install php8.0

If on windows, use xampp or whatever you are using, to update php :)

ishahzeb's avatar

You need to install the PHP 8 version by yourself its difficult to update PHP versions at traditional hostings, I must recommend you to use Cloudways Managed Hosting. They are providing an update PHP versions with a one-click PHP installation with other 50+ features.

bugsysha's avatar
your php version (7.2.19) does not satisfy that requirement
1 like
rhoyle's avatar

if you are using XAMPP then all you have to do is upgrade it to the latest version.

Please or to participate in this conversation.