How do I setup multiple PHP version in my local machine for development?

Leveraging Laragon’s features to effortlessly switch PHP & Apache version in your PC (Windows OS) for software development.

Why do I need that?

The main reason is because I’ve to work on a legacy system which is running on previous version of PHP 5.3. But I still need the latest version of PHP 7.0 in my machine for other projects.

How I handle this situation?

I have been using Laragon since I changed my development machine to Windows instead of MacOS about a year ago. Since Laravel Valet is not available in Windows, Laragon is the best alternative.

I found that Laragon provide a really good features to easily manage virtual server and yes, it supports multiple version of PHP! It works like a charm.

  1. Download Laragon Wamp and install it.
  2. Open the application and you should be able to see this panel.
  3. Click Menu > PHP > Version [php-7.2...] > How to add another PHP version to open a short tutorial provided in Laragon Forum.
  4. Follow those simple steps and now you can have multiple version of PHP in your development machine.
  5. Now if you switch the PHP version to let say php-5.5.0-Win32-VC11-x64, Laragon will prompt a warning saying that PHP & Apache are not compatible. See image below.
  6. To fix this incompatible, you also need to add another version of Apache that are compatible with PHP indicated by same number of VC.
  7. Click Menu > Apache > Version [...] > How to add another Apache version to open another short tutorial provided in Laragon Forum.
  8. Follow those simple steps and after that switch to the compatible Apache version and click Start All button to run the server.
Menu navigation to switch and add another PHP version.
Warning is showing when you have different VC for PHP and Apache.
Menu navigation to switch and add another Apache version.

Conclusion

I hope this sharing could help any of my friends who are facing the same situation. If there is any other tools out there that can solve this problem more efficient and effective, feel free to drop a comment and let me know. I really appreciate that.

Thank you for reading.

1 thought on “How do I setup multiple PHP version in my local machine for development?”

Leave a Reply

Your email address will not be published. Required fields are marked *