Skip to content

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);
    }
Published inCodingLaravel