5

I have a Laravel 7 project running on my PC with PHP version 7.2.5 installed. I want to run another project of Laravel 8 with PHP version>=7.3 required. What can I do? I want to run both projects on my PC at the same time. Thank you!

2
  • 1
    Generally it is not possible to run 2 versions at the same time. But you can dockerize your projects and have each container run with the respective PHP version. laravel.com/docs/8.x/sail Commented Feb 26, 2022 at 11:57
  • I think so Laravel 7 is not supported for sail? Commented Feb 26, 2022 at 12:00

1 Answer 1

2

You can use Docker for it. You can create 2 different docker container, 1 with PHP 7 and one with PHP 8

Or if you are using WAMP or other kind of stack there should be some part to change the PHP version

enter image description here

However, I suggest you to use docker. Laravel 9 comes with sail (I guess older versions too) you can simply install docker desktop and run

sail up

inside your project folder but if you check sail package you will see

    "require": {
        "php": "^7.3|^8.0",

It requires at least PHP 7.3

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

7 Comments

But is not supported for laravel 7. I'm using xampp.
I installed two xampps, one with php version 7.2.5 which is working fine for laravel 7 project and other one is with PHP version 8.0. I changed ports for apache and MySQL for second xampp and in phpinfo.php it is giving 8.0 but when I try to run command composer install , it gives me error that your php version is 7.2.5(Detecting old php version). I thought it will work but not!:(
No you should not install 2 xampss. You should install 1 xampp and 2 PHP versions. I guess you better use Docker. Laravel Sail is just a wrapper for docker. You can use docker-compose.yml file and other dependencies from sail. Actually now that I'm thinking you can use sail for your Laravel 9 and xampp for your Laravel 7
Package laravel/sail has requirements incompatible with your PHP version, PHP extensions and Composer version: - laravel/sail v1.13.5 requires php ^7.3|^8.0 which does not match your installed version 7.2.5.
Yeah I said it in my answer Laravel Sail requires at least php 7.3. You do not need to use sail for your Laravel 7, and you can not. You should use your wamp on your old Laravel 7 project, and sail for your Laravel 8 project. Change your WAMP PHP version to old one serve your Laravel 7 project from there and just use sail up command for your Laravel 8 project.
|

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.