Laravel Installation on Windows

ho-to-install-laravel-in-windows

To install Laravel on Windows, open PowerShell as administrator and run Laravel’s php.new Windows command, which installs PHP, Composer and the Laravel installer. Restart the terminal, install Node.js LTS, then run laravel new example-app, cd into the folder, run npm install && npm run build and composer run dev. Laravel 13 requires PHP 8.3 or newer.

Installing Laravel on Windows is quick when the environment is clean — and frustrating when it is not. Most of the problems developers hit are not Laravel problems at all: PowerShell blocks the install script, the laravel command is not recognized because Composer’s global folder is missing from PATH, or an old XAMPP installation is still serving PHP 8.1.

This guide is for Windows developers, Laravel beginners and PHP development teams. It covers the three practical ways to set Laravel up on Windows, database configuration, the Windows-specific errors that waste the most time, and the differences between a Windows workstation and the Linux server the application will probably run on. For the operating-system-neutral overview, see our general guide to how to install Laravel.

What You Need Before Installing Laravel on Windows

Requirement

Details

Windows 10 or 11 (64-bit)

Windows 11 recommended; WSL2 requires a supported build.

PowerShell or Windows Terminal

Windows Terminal is the most comfortable option; administrator rights are needed for the installer.

PHP 8.3 or newer

Laravel 13 requires PHP 8.3 and supports 8.3 to 8.5.

Composer

Manages PHP dependencies; installed automatically by Laravel’s Windows installer.

Node.js LTS and NPM (or Bun)

Compiles frontend assets with Vite.

A database

SQLite works out of the box; MySQL or PostgreSQL optional.

Git for Windows (recommended)

Version control and deployment workflows.

Three Ways to Install Laravel on Windows

Method

What it is

Best for

Trade-off

1. PowerShell installer (php.new)

Laravel’s official script installs PHP, Composer and the Laravel installer natively on Windows

Most developers; closest to Laravel’s documented workflow

Runs a remote script; needs admin rights

2. Laravel Herd for Windows

A native graphical PHP and Laravel environment with bundled CLI tools

Developers who want a managed setup and .test domains

Less manual control; databases need Herd Pro or a separate tool

3. WSL2 + Docker Desktop + Sail

A Linux environment inside Windows running containerized services

Teams whose production runs on Linux; reproducible environments

More moving parts; Docker Desktop licensing for larger companies

(Legacy) XAMPP / WAMP / Laragon

Bundled Apache, PHP and MySQL stacks

Existing setups, or when you only need PHP and MySQL binaries

Bundled PHP is often too old for Laravel 13

Method 1: Install Laravel with PowerShell (Recommended)

Step 1: Open PowerShell as administrator

Press the Start button, type PowerShell, then choose “Run as administrator”. Administrator rights are required because the installer writes to system-level paths.

Step 2: Run Laravel’s Windows installer

# Run as administrator in PowerShell
Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.5'))

This single command installs PHP, Composer and the Laravel installer. The Set-ExecutionPolicy Bypass -Scope Process part applies only to the current PowerShell session, so it does not permanently weaken script policy on the machine. Re-running the same command later updates PHP, Composer and the installer.

SECURITY PRACTICE

On company-managed laptops, review remote install scripts against your IT change-control policy before running them as administrator. Organizations that need package-level control usually prefer the WSL2 or Docker route, or a managed internal installer.

Step 3: Restart the terminal and verify

php -v
composer --version
laravel --version

Close and reopen the terminal first so the updated PATH is loaded. php -v must report 8.3 or newer for Laravel 13. Note that laravel –version shows the Laravel installer version, not a project’s framework version — a distinction covered in our guide to how to check your Laravel version.

Step 4: Install Node.js

Download the current LTS release from the official Node.js website, or use nvm-windows if you need to switch Node versions per project. Then verify:

node -v
npm -v

Step 5: Create the application

laravel new example-app
cd example-app

Step 6: Install frontend dependencies and start the app

npm install && npm run build
composer run dev

The composer run dev script starts the local development server, queue worker and Vite development server together. Open http://localhost:8000 — if the Laravel welcome page loads, the installation works.

Step 7: Confirm the framework version

php artisan --version
php artisan about

php artisan about also reports the PHP version, environment and configured drivers, which makes it the fastest way to confirm a Windows setup is coherent.

Method 2: Install Laravel Using Herd for Windows

Laravel Herd is a native PHP and Laravel development environment for macOS and Windows. The Windows installer is available from the Herd website, and Herd bundles command-line tools for php, composer, laravel, expose, node, npm and nvm, so you do not install them separately.

During installation Herd creates a parked directory at %USERPROFILE%\Herd. Any Laravel application placed there is served automatically on a .test domain matching the folder name — so my-app becomes http://my-app.test with no manual virtual-host configuration.

cd ~\Herd
laravel new my-app
cd my-app
herd open

Herd suits developers who want a managed environment and switch between projects and PHP versions often. Local MySQL, PostgreSQL and Redis services require Herd Pro, the paid tier; alternatively use a standalone database installer or a tool such as DBngin.

Method 3: Install Laravel on Windows with WSL2 and Docker (Sail)

Laravel Sail is a command-line interface for Laravel’s Docker development environment, and it is supported on Windows through the Windows Subsystem for Linux 2 (WSL2). This path matters when your production environment is Linux and you want developers running the same PHP, database and cache versions as the server.

  1. Install and enable WSL2, then install a Linux distribution such as Ubuntu from the Microsoft Store.

  2. Install Docker Desktop and configure it to use the WSL2 backend.

  3. Open Windows Terminal and start a session in your WSL2 Linux distribution.

  4. Create or open the Laravel application from inside the Linux file system, not from /mnt/c, because cross-file-system access is noticeably slower.

To add Sail to an existing application:

composer require laravel/sail --dev
php artisan sail:install

./vendor/bin/sail up

Sail’s compose.yaml defines the containers for the application and its services, and php artisan sail:install lets you choose which services to include. Because your WSL2 distribution is usually Ubuntu, the commands in our guide to installing Laravel on Ubuntu apply inside that environment.

One licensing note: Docker Desktop requires a paid subscription for larger organizations. Check Docker’s current terms before standardizing on it across a company.

Do You Still Need XAMPP, WAMP or Laragon?

No. Laravel does not require XAMPP, WAMP or Laragon, and Laravel’s own documentation does not use them. These bundles package Apache, PHP and MySQL together, which was convenient before modern tooling existed.

If you already use one, it can still serve as a source of PHP and MySQL — but check the PHP version first with php -v, because bundled PHP is frequently older than Laravel 13’s 8.3 minimum. You will also need Composer and the Laravel installer separately, and the bundle’s Apache virtual host must point at the application’s public directory, never the project root. For most new Windows setups, the PowerShell installer or Herd is simpler and closer to Laravel’s documented workflow.

Configuring the Database on Windows

A new Laravel application uses SQLite by default. Laravel creates database/database.sqlite during project creation and runs the initial migrations, so you can start building immediately without installing a database server.

To use MySQL instead, install it through Herd Pro, DBngin, the official MySQL installer for Windows, or a Docker container, then update the .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=your_user
DB_PASSWORD=your_password

Then create the database and run the migrations:

php artisan migrate

Use a dedicated database user with only the permissions the application needs, even locally. Habits formed on a workstation tend to be copied into production.

Fixing PATH Problems on Windows

Most “command not recognized” errors on Windows are PATH problems. Composer installs global packages — including the Laravel installer — into:

%USERPROFILE%\AppData\Roaming\Composer\vendor\bin

If that folder is not in PATH, Windows cannot find the laravel command. To fix it: open Settings, search for “environment variables”, choose “Edit the system environment variables”, click Environment Variables, select Path under user variables, click Edit, then New, and paste the folder path. Close and reopen the terminal afterwards — running terminals do not pick up PATH changes.

To inspect the current PATH in PowerShell:

$env:Path -split ';'

Common Laravel Installation Errors on Windows

Error

Cause and fix

“php is not recognized…”

PHP is not installed or not in PATH. Reopen the terminal, then re-run the php.new installer or add PHP’s folder to PATH.

“composer is not recognized…”

Composer is not installed or not in PATH. Verify with composer –version and reinstall if needed.

“laravel is not recognized…”

Composer’s global bin folder is missing from PATH (see the section above), or the terminal was not restarted.

“running scripts is disabled on this system”

PowerShell execution policy. Use the Set-ExecutionPolicy Bypass -Scope Process prefix shown above, which applies only to that session.

PHP version too old

An old XAMPP, WAMP or standalone PHP is first in PATH. Check php -v and remove or reorder the old entry.

Missing extension (ext-mbstring, ext-zip…)

Enable it in php.ini by removing the leading semicolon from the extension line, then restart the terminal. Check with php -m.

SSL certificate problem / cURL error 60

PHP has no CA bundle configured. Point curl.cainfo and openssl.cafile in php.ini at a current cacert.pem file.

“Could not open input file: artisan”

You are not in the project root. cd into the folder that contains the artisan file.

Port 8000 already in use

Another process holds the port. Find it with netstat -ano | findstr :8000, or serve on another port for troubleshooting.

npm install fails on long paths

Windows path-length limit. Enable long paths in Windows settings, or move the project closer to the drive root (for example C:\dev).

Very slow installs and builds

Antivirus scanning of vendor and node_modules. Add development folder exclusions where your IT policy allows.

Shell scripts fail after cloning

CRLF line endings were applied to Linux shell scripts. Configure Git line-ending behaviour for the repository and use .gitattributes.

Windows Development vs Linux Production

Most Laravel applications are deployed to Linux servers. Several differences between a Windows workstation and a Linux server cause bugs that only appear after deployment — which is why staging environments matter.

Difference

Why it matters

How to handle it

File-name case sensitivity

Windows ignores case, Linux does not. A view or class referenced with the wrong case works locally and fails in production.

Match file names exactly; test on Linux or WSL2 before release.

Line endings

Windows uses CRLF; Linux shell scripts expect LF.

Commit a .gitattributes file defining line endings per file type.

Path separators

Windows uses backslashes.

Use Laravel path helpers and the DIRECTORY_SEPARATOR constant rather than hard-coded paths.

File permissions

Windows has no equivalent of Linux ownership for storage and bootstrap/cache.

Set permissions as part of deployment, not by copying local behaviour.

Services

Redis, queue workers and the scheduler often run only in production.

Use WSL2, Docker or a staging environment to test queues and scheduled jobs.

Environment configuration

Local .env values differ from production, and APP_DEBUG must be false in production.

Manage environment values through your deployment process, never in source control.

If your production environment is Linux, developing inside WSL2 or Docker removes most of these differences at the cost of a slightly more involved setup. For server-side configuration, see our guide to installing Laravel on Ubuntu.

Which Windows Setup Should Your Team Choose?

Situation

Recommended setup

Learning Laravel on a personal machine

PowerShell installer, or Herd if you prefer a managed graphical environment.

Solo developer juggling several client projects

Laravel Herd, for easy PHP-version switching and .test domains.

Small team, simple hosting

PowerShell installer plus a documented setup guide in the repository.

Team with Linux production servers

WSL2 with Docker Desktop and Sail, for environment parity.

Regulated or enterprise IT environment

Containerized setup with dev containers and CI, aligned with internal security policy.

When Should You Get Professional Laravel Help?

Installation rarely needs outside help. These situations usually do:

  • Several developers have different local setups and “works on my machine” bugs are common.

  • The application runs on Windows locally but fails or behaves differently on the Linux server.

  • You need staging, CI/CD, queue workers, Redis and scheduled tasks configured and monitored.

  • An inherited Laravel application has no documented environment or deployment process.

  • Corporate IT policy restricts installers, admin rights or Docker licensing, and the team needs a compliant setup.

Conclusion

Installing Laravel on Windows comes down to three choices: the PowerShell installer for a standard native setup, Laravel Herd for a managed graphical environment, or WSL2 with Docker and Sail for parity with a Linux production server. All three end at the same place — laravel new, npm install && npm run build and composer run dev.

The part worth planning is what comes after. Case sensitivity, line endings, permissions and background services behave differently on the Linux servers most Laravel applications run on. Teams that document their environment and test on a Linux-like setup spend far less time debugging problems that appear only after deployment.