How to run two different versions of laravel side by side with different php versions

Viewed 990

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!

1 Answers

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

Related