Add different PHP versions to your Laragon Installation

Introduction

Laragon is a WAMP (Windows, Apache, MYSQL & PHP) local server that you can install on your machine. If you have used Wampserver, you would understand how this app works.

Laragon has a lot more to offer than Wampserver, XAMPP or EasyPHP local servers. The app comes bundled with “Quick Installs” for WordPress, Drupal, Joomla, Laravel and other widely used Custom Management Systems.
You can also create local SSL certificates on your localhost projects installed while running them with your custom hostname.

Challenge

As a PHP developer, you have probably encountered a situation with a project that required an old version of the PHP.

Below are a few compatibility errors/warning you’ll encounter when running an old project that was built on versions < && !=== PHP 7 :)

- Parse error: syntax error, unexpected
- Notice: Only variable references should be returned by reference in ...
Only variable references should be returned by reference 

Solution

You want to add PHP 5.6 to Laragon installation. Easy!

Step 1

Visit the PHP download archives. For this post, I have downloaded PHP-5.6 threaded version.

Here’s a quick note. The thread-safe version is preferred and efficient if you install PHP as an Apache module. Otherwise, if you install PHP as a CGI binary, you should use the non-thread safe version. An example would be Nginx or if you are running PHP from a command line.

Step 2

Extract the zip archive in the PHP folder within your Laragon installation.

C:\laragon\bin\php\

Laragon will pick up the folder name as the identifier.

Step 3

Right-click on the Laragon icon on your taskbar. Navigate to PHP and choose the version you just extracted. See the screenshot below.

Restart Laragon and you are good to go.

Conclusion

I have such a breeze using Laragon on Windows. It works well, and you can also have Redis, Memcached and MongoDB activated. My favorite feature is Ngrok within the app, with a click you can create a tunnel to share your localhost project.

Thanks for reading and let me know what you think in the comments. You can also hit me up on Twitter or LinkedIn