Ryan Stubbs

Web Developer, Creative

Changing the PHP Version in Laragon (Tutorial)

,

Laragon is an awesome tool for local PHP development, and it makes switching between PHP versions a breeze. Whether you want to try out new features or ensure compatibility with different projects, Laragon’s got your back. In this tutorial, we’ll show you how to change the PHP version in Laragon with just a few easy steps. Let’s dive in!

Step 1: Fire Up Laragon

Launch Laragon by clicking on its icon on your desktop or finding it in the start menu. Laragon will start up and handle all the necessary services, like the web server and database.

Step 2: Access the Laragon Menu

Look for the Laragon icon in the system tray at the bottom-right corner of your screen. Click on it, and voilà! The Laragon menu will pop up, revealing a bunch of cool options.

Step 3: Choose Your PHP Version

Hover your mouse over the “PHP” option in the Laragon menu. This will display a list of the PHP versions available in your Laragon environment.

Step 4: Get the Latest PHP

If you don’t have the desired PHP version installed, or if you’re looking for a newer version that isn’t included in Laragon, don’t worry! You can download it directly from the official PHP website (https://windows.php.net/download/). Pick the version you want and make sure to select either the NTS (Non Thread Safe) or TS (Thread Safe) version, depending on your needs (you’ll generally want the Thread Safe version). The zip option is the one you’ll need – here I’ve chosen PHP 8.2.7 – VS16 x64 Thread Safe. Save this and extract the archive once it’s downloaded.

Step 5: Copy the PHP Directory

Once you’ve extracted the files, copy them to the bin/php directory of Laragon. This is typically C:\laragon\bin\php but it may be different dependent on your installation settings – you can leave the directory name the same as the archive.

Step 6: Switch It Up

With multiple PHP versions available in Laragon, switching is a breeze. Go back to the Laragon menu and simply click on the PHP version you want to use. Laragon will handle the rest and update your PHP environment accordingly.

Step 7: Verify the PHP Version

Let’s make sure everything went smoothly. Open your favourite text editor and create a new file named phpinfo.php. Add the following code:

Save the file and move it to the www directory in your Laragon installation folder (typically C:\laragon\www). Now, open your web browser and visit http://localhost/phpinfo.php. Look for the PHP version at the top of the page. If it matches the one you selected, congratulations! You’ve successfully changed the PHP version in Laragon.

Conclusion

Changing the PHP version in Laragon opens up a world of possibilities for PHP developers. With Laragon’s user-friendly interface, it’s as easy as a few clicks. Explore different PHP environments, try out new features, and ensure your projects are compatible with different PHP versions. Laragon empowers you to effortlessly switch PHP versions and supercharge your local PHP development workflow. Happy coding!

Leave a Reply

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