How to add Laragon in the Windows PATH

Video thumbnail

Laragon is a portable and isolated integrated development environment for the PHP and MySQL programming language; although, with it, we can easily develop other technologies like Python, Node and many more. In addition, Laragon includes features such as the ability to deploy projects with a single click and software version management and is the software I personally use to develop on windows both professionally and in my courses and books. Laragon is designed to be easy to use and offer a smooth user experience.

In the previous video, I recommended Laravel Herd instead of Laragon.

One of the problems we have with Laragon is that the ENTIRE ecosystem that we have installed in it is established in one place, through the terminal that comes by default, which, although excellent, falls short when, for example, we want to use the system one, the CMD or when we develop in our Visual Studio Code and we CANNOT use the one that comes embedded in said system.

If you use Laragon on Windows, you've probably experienced this: everything works perfectly within Laragon, but when you try to use PHP in CMD, PowerShell, or Visual Studio Code… it simply doesn't work.

  • The problem isn't PHP. Nor is it Laragon.
  • The problem is the PHP Path.

What is the PHP Path in Laragon and why it is important

The PHP Path is the route where the PHP executable (php.exe) is located on your system.

In Laragon, it is usually:

C:\laragon\bin\php\php-[version]\php.exe

This path is key because it allows:

  • Windows to find PHP
  • CMD and PowerShell to execute it
  • VS Code to detect it automatically

If it is not configured, PHP will only work inside Laragon.

Why Laragon doesn't expose PHP to the system

Laragon is designed as an isolated environment.

This means that:

  • It does not modify your system automatically
  • It does not add PHP to the PATH by default
  • It avoids conflicts with other installations

This is good… but it is also the reason why you cannot use PHP outside of Laragon without configuring it.

Where to find the PHP Path in Laragon

Default path for php.exe

By default, Laragon installs PHP in:

C:\laragon\bin\php\

Inside you will find folders such as:

php-8.1.10
php-8.2.0

Each folder contains its own php.exe.

How to know which PHP version you are using

You can check it easily:

Option 1 (from Laragon)

  • Right-click on Laragon
  • Go to: PHP > Version

Option 2 (from terminal)

php -v

Adding Laragon to Windows Environment Variables

In Laragon, we have this option to add Laragon to the PATH through an environment variable hidden from view; to perform this operation, we go to our Laragon window:

Laragon UI
Laragon UI

Right-click on a white/blank space and go to the option:

Add Laragon to Path option

And DONE! with this, we can enjoy the ENTIRE Laragon ecosystem in any Windows terminal, including CMD, PowerShell, and those provided by VS Code, as it has just been added to the Windows environment variables.

In summary:

  • Open Laragon
  • Right-click on the window
  • Go to:
    • Tools > Path > Add Laragon to PATH
  • Restart the terminal
  • Run:
    • php -v

How to use multiple PHP versions in Laragon

One of the best features of Laragon is being able to switch versions easily.

Adding new versions

Download PHP (Thread Safe)

  1. Copy into:
  2. C:\laragon\bin\php\

Changing the active version

  • Right-click on Laragon
  • Go to:
PHP > Version

This will automatically change the version used in the system (if you use the Laragon PATH).

Common issues with Laragon PHP Path (and solutions)

PHP is not recognized in CMD

Error:

$ 'php' is not recognized as a command

Solution:

  • Add Laragon to the PATH
  • Restart terminal

VS Code does not detect PHP

Solution:

  • Configure php.validate.executablePath
  • Restart VS Code

Conflicts with other installations

If you have XAMPP or PHP installed:

  • Another version might be running
  • PATH might be poorly ordered

Solution:

  • Remove duplicate routes
  • Prioritize Laragon in the PATH

In my case, this was the real problem: I had another PHP installed and Laragon was not being used.

You changed the version but it's not reflected

Solution:

  • Restart terminal
  • Run php -v
  • Verify PATH

Best practices when using PHP with Laragon

  • Use the automatic method whenever you can
  • Avoid multiple PHP installations
  • Always verify with php -v
  • Document your environment if you work in a team

Conclusion

Correctly configuring the Laragon PHP Path is essential for working professionally on Windows.

Although Laragon simplifies development a lot, you need to take this step to use PHP in external tools like CMD or VS Code.

The good news is that you can do it in seconds, and once configured, your workflow improves dramatically.

FAQs about Laragon PHP Path (SEO + traffic)

  • What is the Laragon PHP Path?
    • C:\laragon\bin\php\php-[version]\php.exe
  • How to add Laragon to the PATH?
    • From:
    • Tools > Path > Add Laragon to PATH
  • Why doesn't PHP work in CMD?
    • Because it is not added to the Windows PATH.
  • How to use Laragon's PHP in VS Code?
    • By adding Laragon to the PATH or configuring:
      • php.validate.executablePath
  • Can I have several versions of PHP in Laragon?
    • Yes, and you can switch them easily from the Laragon menu.
  • What to do if php -v doesn't work?
    • Verify PATH
    • Restart terminal
    • Check for conflicts
  • Does Laragon automatically modify the system?
    • No, it only does so if you manually activate the PATH option.

Learn how to configure Laragon at the operating system level in Windows using the system PATH, which will allow you to use Laragon on any terminal of the OS.


Únete a la comunidad de desarrolladores que han decidido dejar de picar código y empezar a construir productos reales. Recibe mis mejores trucos de arquitectura cada semana:

I agree to receive announcements of interest about this Blog.

Andrés Cruz

ES En español