2

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].
4
  • 1
    this seems like an environment issue. One laravel version runs on PHP 7, while the other requires PHP 8+. So if you want to keep both of those running you have to find a way to run both php versions (or update the oldest project to the newest laravel version) Commented Jun 5, 2022 at 21:11
  • I am working on Local. I already tried with Laragon. But composer error still remains. If I update the composer, all existing projects will stop working. How can fix composer issue? Currently I am using XAMPP. Can I use both XAMPP and Laragon at the same time.? Commented Jun 5, 2022 at 21:38
  • 1
    "If I update the composer, all existing projects will stop working". What does this mean? Are you updating the version of Composer or are you running composer update inside your project to update the composer.json versions? For the last case, you should never be able to screw up other projects since you are working in a project context. Commented Jun 5, 2022 at 21:43
  • you can try to install latest XAMPP on different drive and can use that for the latest version. Commented Jun 6, 2022 at 5:11

5 Answers 5

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

I am working on Local. I already tried with Laragon. But composer error still remains. If I update the composer, all existing projects will stop working. How can fix composer issue? Currently I am using XAMPP. Can I use both XAMPP and Laragon at the same time.?
0

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 

Comments

0

I also had the same problem. I solved it with this:

composer require laravel/sail:*

Comments

0

This needs to change your PHP version use the next:

sudo update-alternatives --config php

enter image description here

Type selection number: 5 to chose the version php8.0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.