简体   繁体   中英

Laravel Version, PHP Version and Composer Version Compatibility Issue

I have installed PHP version 7.3.33, composer 1.1 and running multiple laravel 7.x projects.

Now I am trying to install two different Laravel Projects. One with Laravel 9 and the other with 7.x.

If I update the PHP and Composer Version, it will create issues in existing laravel 7.x projects.

Is there any way to Upgrade/ make compatible the old laravel projects to composer 2 and new PHP version.

    Problem 1
    - This package requires php ^8.0.2 but your PHP version (7.4.29) does not satisfy that requirement.
  Problem 2
    - Installation request for laravel/framework v9.1.0 -> satisfiable by laravel/framework[v9.1.0].
    - laravel/framework v9.1.0 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 3
    - Installation request for league/flysystem 3.0.8 -> satisfiable by league/flysystem[3.0.8].
    - league/flysystem 3.0.8 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 4
    - Installation request for psr/log 3.0.0 -> satisfiable by psr/log[3.0.0].
    - psr/log 3.0.0 requires php >=8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 5
    - Installation request for psr/simple-cache 3.0.0 -> satisfiable by psr/simple-cache[3.0.0].
    - psr/simple-cache 3.0.0 requires php >=8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 6
    - Installation request for symfony/console v6.0.3 -> satisfiable by symfony/console[v6.0.3].
    - symfony/console v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 7
    - Installation request for symfony/css-selector v6.0.3 -> satisfiable by symfony/css-selector[v6.0.3].
    - symfony/css-selector v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 8
    - Installation request for symfony/deprecation-contracts v3.0.0 -> satisfiable by symfony/deprecation-contracts[v3.0.0].
    - symfony/deprecation-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 9
    - Installation request for symfony/error-handler v6.0.3 -> satisfiable by symfony/error-handler[v6.0.3].
    - symfony/error-handler v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 10
    - Installation request for symfony/event-dispatcher v6.0.3 -> satisfiable by symfony/event-dispatcher[v6.0.3].
    - symfony/event-dispatcher v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 11
    - Installation request for symfony/event-dispatcher-contracts v3.0.0 -> satisfiable by symfony/event-dispatcher-contracts[v3.0.0].
    - symfony/event-dispatcher-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 12
    - Installation request for symfony/finder v6.0.3 -> satisfiable by symfony/finder[v6.0.3].
    - symfony/finder v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 13
    - Installation request for symfony/http-foundation v6.0.3 -> satisfiable by symfony/http-foundation[v6.0.3].
    - symfony/http-foundation v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 14
    - Installation request for symfony/http-kernel v6.0.4 -> satisfiable by symfony/http-kernel[v6.0.4].
    - symfony/http-kernel v6.0.4 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 15
    - Installation request for symfony/mailer v6.0.3 -> satisfiable by symfony/mailer[v6.0.3].
    - symfony/mailer v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 16
    - Installation request for symfony/mime v6.0.3 -> satisfiable by symfony/mime[v6.0.3].
    - symfony/mime v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 17
    - Installation request for symfony/process v6.0.3 -> satisfiable by symfony/process[v6.0.3].
    - symfony/process v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 18
    - Installation request for symfony/routing v6.0.3 -> satisfiable by symfony/routing[v6.0.3].
    - symfony/routing v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 19
    - Installation request for symfony/service-contracts v3.0.0 -> satisfiable by symfony/service-contracts[v3.0.0].
    - symfony/service-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 20
    - Installation request for symfony/string v6.0.3 -> satisfiable by symfony/string[v6.0.3].
    - symfony/string v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 21
    - Installation request for symfony/translation v6.0.3 -> satisfiable by symfony/translation[v6.0.3].
    - symfony/translation v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 22
    - Installation request for symfony/translation-contracts v3.0.0 -> satisfiable by symfony/translation-contracts[v3.0.0].
    - symfony/translation-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 23
    - Installation request for symfony/var-dumper v6.0.3 -> satisfiable by symfony/var-dumper[v6.0.3].
    - symfony/var-dumper v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 24
    - Installation request for nunomaduro/collision v6.1.0 -> satisfiable by nunomaduro/collision[v6.1.0].
    - nunomaduro/collision v6.1.0 requires php ^8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 25
    - Installation request for spatie/flare-client-php 1.0.2 -> satisfiable by spatie/flare-client-php[1.0.2].
    - spatie/flare-client-php 1.0.2 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 26
    - Installation request for spatie/ignition 1.0.5 -> satisfiable by spatie/ignition[1.0.5].
    - spatie/ignition 1.0.5 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 27
    - Installation request for spatie/laravel-ignition 1.0.6 -> satisfiable by spatie/laravel-ignition[1.0.6].
    - spatie/laravel-ignition 1.0.6 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
  Problem 28
    - laravel/framework v9.1.0 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
    - laravel/sail v1.13.4 requires illuminate/console ^8.0|^9.0 -> satisfiable by laravel/framework[v9.1.0].
    - Installation request for laravel/sail v1.13.4 -> satisfiable by laravel/sail[v1.13.4].

You need to create a new environment for the laravel 9 since it's not compatible with php 7. You can do it with docker Laravel sail or Virtual Machine Laravel homestead .

If you'r on a production environment , i recommend you to use another server instance or deploy in a container. In other way, you also can use PHP-FPM with Apache / Nginx.

If you're on Local environment and don't have any knowledge of admin system / devops, you can use Laragon or Wamp and install different version of PHP

I'm on windows and how I combat this is by downloading the versions of PHP I desire and putting them inside folders that are within the same directory. Inside parent folder I have php72 php74 php8 .

Then I edit my path location in my terminal and point to that same folder however I reference the folder php .

Assuming in my directory I have php72 php74 php8 and I wish to use php8 I would rename that folder to just php

Now my directory looks like this php72 php74 php

If I need to change to php72 I would rename the directories as below php php74 php8

I also implement a similar solution for composer

It's a bit of weird hacky way, however its easy to implement and works for me, hopefully it can for you too.

It's because in your project in composer.json file you have:

"require": {
    "php": "^7.4",
    .....
},

Try to update this requirement to:

"require": {
    "php": "^7.4|^8.0",
    .....
},

Or another option if you wouldn't to install any new version PHP you can do this. It will ignore reqs.

 composer install --ignore-platform-reqs 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM