skip to Main Content

Here I’m working on a simple laravel project which uses php version of 7.1.3 and I have php version 8.1.2 installed on my computer.

How do I specify specific php version for different projects?

I tried to re-install php 7.1 version but I have other projects on my computer which uses 8 or higher.

Can I specify specific php version for different laravel projects?

2

Answers


  1. I think Docker is the best solution for you, because it doesn’t matter which php version is installed on your computer. Here is some link for ‘Dockerizing’ your Laravel application. Hope this helps 🙂

    Login or Signup to reply.
  2. Use Laragon

    I don’t know if it is possible with other stacks but Laragon is a lightweight ans performant option.

    As described here it’s easy and there are few steps.

    1. Install Laragon as your LAMPP or LEMMP stack for windows
    2. Download your desired PHP version from official website
    3. Extract downloaded zip in PHP folder within your Laragon installation.
    4. Right-click on the Laragon icon in your stystem tray. Navigate to PHP and choose your version!
    5. Restart Laragon and done!

    enter image description here

    The default installation path is:

    C:laragonbinphp
    

    Laragon will pick up the folder name as the identifier.

    Note: You Can config apache or nginx to serve each directory with its own version but it is not included in this post. you should learn it from official documentations.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search