Setting a Local Development Environment for Laravel on Windows | Install Laravel on Windows

Many developers use Windows for PHP projects, we will cover a basic XAMPP Setup for a Laravel project. Following these easy steps will help you run your PHP projects and install Laravel on Windows in a matter of minutes.

Installing XAMPP for Laravel

  1. Download XAMPP for Windows from their official site:
  2. For our example, we’ve chosen PHP 7.1 and XAMPP 32 bit
  3. Run the installer and select Apache, MySQL and phpMyAdmin
  4. It’s recommended to make the installation in C:\ to avoid issues with Windows User permissions (or the drive where your Windows is installed)
  5. After it’s complete do not start anything just yet.

Setting PHP from Windows CMD

  1. Open Advanced System Settings (System Properties -> Advanced)
  2. Open Environment Variables
  3. On the top window select Path and click on Edit
  4. In the new window click on New
  5. We need to enter the path to XAMPP’s PHP
  6. We will also add MySQL’s Path, click on New again and enter

Composer from Windows CMD

  1. Download Composer’s Windows .exe installer:
  2. Place the installer and run it from the added to Path directory – C:\xampp\php

Now that we have Apache, PHP, MySQL and Composer installed, we’re ready to install Laravel, set a Virtual Host with a custom domain for local development. XAMPP’s Apache uses the htdocs folder for serving HTTP requests, we’ll set our custom Laravel Virtual Host under C:\xampp\htdocs\example\ which will be opened locally from

cPanel Hosting from WebhostFace

Install Laravel on Windows with Composer

  1. Open Window’s CMD or PowerShell
    cd C:\xampp\htdocs
  2. Install Laravel using Composer
    composer create-project --prefer-dist laravel/laravel example

Creating MySQL Database for Laravel

  1. Open the CMD or PowerShell again
  2. Access the MySQL CLI
    mysql -u root -p
  3. Create Database for Laravel

Setting Laravel’s .env file

  1. Navigate to C:\xampp\htdocs\example
  2. Open the config/database.php file and edit the MySQL Connection settings
    'mysql' => [
        'read' => [
            'host' => [
        'write' => [
            'host' => [
        'sticky'    => true,
        'driver'    => 'mysql',
        'database'  => 'laravel',
        'username'  => 'root',
        'password'  => 'THE ONE YOU CREATED THE USER WITH',
        'charset'   => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix'    => '',

Virtual Host with XAMPP

  1. Navigate to C:\xampp\apache\conf\extra
  2. Open httpd-vhosts.conf and append:
    NameVirtualHost *:80
        DocumentRoot "C:\xampp\htdocs\example\public"
        <Directory "c:/xampp/htdocs/example/public">
            Require all granted

Enable mod_rewrite for Laravel

  1. Open the httpd.conf file in C:\xampp\apache\conf\extra
  2. Look for LoadModule rewrite_module modules/ and remove the ; at the start

Setting local domain with hosts file

  1. Navigate to c:\Windows\System32\Drivers\etc
  2. Open the hosts file with Administrator Privileges
  3. Append the line at the bottom

Start Apache and MySQL, your local Laravel project will be opened from and you’re ready to start working on it. When ready you can contact us to have it deployed on a WebHostFace server

You can benefit from a fast and reliable SSD Laravel Hosting with our shared hosting services. Now with a greatly discounted price! Start your new Laravel project on a professionally set hosting environment without investing a large amount of money and grow your online presence!