Local WordPress Development on Windows with Laragon

Introduction

Laragon is fast and powerful local development environment for Windows that supports PHP and Node.js, among others. A few of the standout features include:

  • Lightweight, using less than 4MB of memory when running.
  • Portable, can be moved to other devices or the cloud.
  • Isolated, keeps your system clean and doesn't rely on Windows services.
  • Easily switch versions of PHP, Nginx, MySQL, etc.
  • Supports pretty URLs, example.test.

Installation

I will be using the full version of Laragon rather than the portable version.

1 - Download Laragon.

2 - Run the Laragon installer.

Switch to Nginx

It's ideal for your local and production enviroments to match as closely as possible. I'm using Nginx here because, more often than not, I use Nginx in production. If you are using Apache in production then you can stick with that and skip this section.

1 - In the Laragon app, click Menu and click Preferences.

2 - Click the Services & Ports tab.

3 - Uncheck Apache, and select Nginx under Advanced.

Add PHP 8.0

Laragon, as of Septmeber 2022, comes with PHP 7.4. Security support for PHP 7.4 ends in November 2022 so I've opted to add PHP 8.0. You can add any other PHP version in the same way.

1 - Download PHP 8.0 (latest version), the Thread Safe version.

2 - Extract the ZIP and move the entire directory to your Laragon installation folder; in my case I moved the directory to C:\Laragon\bin\php.

4 - In the Laragon app, click Menu and navigate to PHP > Version and select 8.0.

Add MySQL 8.0

Laragon, as of Septmeber 2022, comes with MySQL 5.7. These are the steps to install MySQL 8, if you prefer to stick with MySQL 5.7 you can move on to installing WordPress.

1 - Download MySQL 8.0 (latest version), the ZIP archive that doesn't include extras for debugging and testing.

2 - Extract the ZIP and move the entire directory to your Laragon installation folder, in my case I moved the directory to C:\Laragon\bin\mysql.

4 - In the Laragon app, click Menu and navigate to MySQL > Version and select 8.0.

You will likely receive an error when attempting to start MySQL using the Start All button. You can view the exact error by clicking Menu and navigating to MySQL > mysqld.log. Scroll to the time of the error and you should see a line asking you to perform the MySQL upgrade procedure.

MySQL Upgrade Procedure

1 - Navigate to the data directory within your Laragon installation directory, in my case that was C:\Laragon\data.

2 - If you see a mysql-8 directory, delete it. Now, rename the mysql directory to mysql-8.

3 - Back in the Laragon app, click the Start All button. MySQL should now start successfully.

WordPress Site Example

1 - Open the Laravel app and click the Start All button at the bottom left. If this is your first time starting services, and you get a firewall popup, click the Allow Access button.

2 - Click Menu and navigate to Quick app and select WordPress.

3 - Enter a name for your project and click the OK button. Note, the site URL is generated from the project name.

4 - Laragon will now download WordPress and create the database. Once this process has been completed, click the Visit Site button.

5 - Install WordPress.

Conclusion

I don't have as much expereince with Laragon on Windows as I do with Valet+ on macOS but the Laragon install went much smoother and getting a WordPress site up and running is slightly faster. The sites themselves are also very fast much like Valet+.

If you are looking for an alternative that is dead simple to install, start up a site, and has a slick GUI, checkout Local. Local is a great app but I prefer the simplicity and leanness of Laragon.

Links/References