How to switch or update PHP version in Laragon
Tags: php, laragon, windows, tutorial
Published: 2024-05-31 12:44:48

Laragon is a portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby. It is fast, lightweight, easy-to-use and easy-to-extend. 

Unlike other development environments, in Laragon you can change the version of the programming language and database used in Laragon, which is what makes Laragon easy to use and extend.

However, Laragon no longer receives updates since it was last updated on September 16, 2022. And if you want to find out how to update the programming language or database used, it will be a little difficult because Laragon itself doesn't have any documentation about it.

## How to switch or update PHP version
First of all, make sure you have Laragon installed on your Windows, you can download Laragon via this link [laragon.org/download](https://laragon.org/download/)

### Download PHP version for Windows
Search for the PHP version you want to install on Windows, you can find it via this link [windows.php.net/download](https://windows.php.net/download/). 
![PHP For Windows](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwgryvxhgy3ixu65uiu9.png)Choose according to the Windows architecture you are using (X64 or X86) and decide whether you want thread safety or non-thread safety, I recommend choosing thread safety.

### Download the latest version of Apache
If you choose to update the PHP version to a higher version, don't forget to also update the version of Apache, I recommend downloading the latest version, you can download the latest version of Apache via this link [apachelounge.com/download](https://www.apachelounge.com/download/)
![Apachelounge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5pbedtia3wgev747ys5.png)

### Extract your PHP and Apache to Laragon
If you have successfully downloaded your desired version of PHP and Apache, you can extract it into Laragon

Extract PHP into `laragon > bin > php` folder
![PHP Path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbjwlzvja2edhlr2bqv6.png)

Extract Apache into `laragon > bin > apache` folder
![Apache Path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70yr2xt8zd0ix5kl1ira.png)

### Edit the system environment variables
After you have successfully extracted it, don't forget to edit your system environment variables, you can type env in Windows search to open the menu.

In the system variables section, go to the path menu in the system environment variable and add the paths of PHP and Apache that you downloaded earlier.

![System environment variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rw6h9y7mapsvuo55lt07.png)

Note: move it to the top of the PHP version you want to use, like in the picture where I want to use version 8.3 so I put it at the top.

Once done you can press the Ok button until the system environment variable menu closes, and you can check if the versions of your PHP and Apache have changed using the terminal.

![Terminal Windows](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvxewiwloek4s55vgypo.png)

Good, you have successfully changed it, don't forget to also set the PHP and Apache versions that you are using in Laragon.

![Apache version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn6d56vhufy9kvyjuuij.png)

![PHP version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjos4f2uc4hfsuu4pk5g.png)

You can exit Laragon to restart it after you have finished setting the versions of PHP and Apache. Good luck...