Skip to content

KAV Design Blog Posts

How to run a Laravel project on your local machine

Suppose you have a Laravel project made by somebody else and you need to install it to run on your Windows machine.

  1. Un-archive the project in a folder inside your XAMPP htdocs folder;
  2. Make sure you have Artisan working correctly;
  3. Do the following steps in your console:

composer install
check .env file
php artisan migrate
php artisan key:generate
php artisan db:seed
php artisan make:auth

For more information on the first two steps you can read the previous two posts in our blog.

Configure Laravel and Artisan to work properly on Windows and XAMPP

After you install Laravel like described on the previous post.

You may need to configure some stuff.

  1. Configure XAMPP home directory. Go to XAMPP controll panel on the Apache module -> click config and open httpd.conf file -> Search for htdocs and change DocumentRoot and Directory to C:/xampp/htdocs/laravel/myprojectname/public (just put the full public path to your Laravel installation);
  2. Set up the Laravel environment. Go to C:\xampp\htdocs\laravel\myprojectname and open .env file and put the DB, User and Pass to the ones that you will use.
  3. Enable the Artisan commands.We need to add a new system variable with the PHP path of our XAMPP installation. Go to Control Panel\All Control Panel Items\System -> Advanced system settings -> Advanced tab -> Environment variables -> System variables -> new -> Call the new variable ‘Artisan’ and add the path ‘C:\xampp\php’ -> OK.

    See the video for details:

  4. In order for your database migrations to work properly on XAMPP and MySQL -> go to app/Providers/AppServiceProvider.php and add:
    use Illuminate\Support\Facades\Schema;

    also put this line into the boot method:

    public function boot()
    {
        Schema::defaultStringLength(191);
    }

How to install Laravel on Windows & XAMPP

Four simple steps to install laravel on windows machine:

  1. After installing xampp, just download composer from https://getcomposer.org/download/ and install it.
  2. goto path C:/xampp/htdocs and create a folder as laravel, redirect to laravel using cmd prompt as cd c:\xampp\htdocs\laravel.
  3. then simply type this command to create a first project composer create-project laravel/laravel first-project –prefer-dist Replace first-project with your project name (it takes a few minutes to install)
  4. then redirect to localhost/laravel/first-project/public/ and now you can see the Laravel logo along with a quick message saying “You have arrived.” ( always use a public folder to access project )

More info: https://stackoverflow.com/questions/23881891/laravel-4-1-installation-with-composer-in-xampp