Laravel Virtual Host Xampp

Xampp

Laravel Homestead can be classified as a tool in the 'Virtual Machine' category, while XAMPP is grouped under 'Web Servers'. Laravel Homestead is an open source tool with 3.2K GitHub stars and 1.33K GitHub forks. Here's a link to Laravel Homestead's open source repository on GitHub. In XAMPP, a virtual host is the name given to the localhost so that the developer can easily access assets without the issue of broken links or similar issues. A XAMPP installation can have multiple virtual hosts. Now let us follow all the steps to run the laravel on the windows. Before installing the laravel,we need to install the MySQL database with virtual server called XAMPP. Also, we will add a package manager named “Composer” before moving ahead to the Laravel. To download the XAMPP virtual server, click on the below link.

  • Windows Installed System.

Laravel 5.7 requires PHP version 7.1.3 or more, and some other extensions. Since we are doing setup on XAMPP, it has all the required php extensions within it. Make sure to Install the XAMPP with version >=7.2.0

The virtual host needs to point out the same host declared in the hosts file of windows (in this case 127.0.0.3) at the port 80. You can create this virtual host appending the following code at the end of the content of the httpd.vhosts-conf file located in the xampp folder xamppapacheconfextra. There are Two Changes is to done to Create Virtual Host for Laravel Project on Xappp in Windows 10. Just Follow the below Steps:. Step 1:- Go to xampp apache conf extra and open httpd-vhosts.conf file. See the Below Image:. Step 2:- Just Copy and Paste the Below Code but and write your project directory url and remember that, if your Laravel Project is Running on public folder then use public after your project name in DocumentRoot.

Install XAMPP

First of all we need to download and install XAMPP for Linux. Download it from the apache friends official website. Download the XAMPP version > 7.2.0 which contains PHP version 7.1.3

Follow the steps for XAMPP installation. For Windows, the default installation directory for XAMPP is C:xampp

Once the XAMPP is installed you should be able to access its manager console.

If your XAMPP is correctly installed and apache web server if turned on in the xampp control panel, You should see this page when you access http://locahost in your browser.

Once you are done with XAMPP, it’s now time to setup Composer.

Composer is a dependency management or package management tool which is integrated with Laravel Framework. Check by running composer command in your terminal if your system has composer already installed in it.

If not you can install it by following this tutorial How to Install Composer on Windows

The default directory of XAMPP for installing or keeping PHP project is htdocs. Navigate to following directory in your terminal C:xampphtdocs and run following composer command to create a fresh Laravel 5.7 version

After running this command composer should start downloading dependencies that are required to create the Laravel project.

When it finishes it will create a Laravel 5.7 project with following data structure.

Now, it’s time to run the Laravel project that we have installed. There are couple of ways you can do this.

#1 Artisan Command

Artisan command are built into the Laravel library, and one of it’s command it to serve the project on server. Navigate to the directory in which you have created your new laravel project and run following command.

And then, open the following link in the browser: http://localhost:8000

#2 XAMPP Virtual Host.

If you are looking to assign a permanent domain to your project, you can do so by configuring the xampp virtual host.

Xampp

We need to configure XAMPP Virtual Host to set the document root to correct directory of laravel project and to also assign a name to the project by which we will be accessing it in browser.

Navigate and open file C:xamppapacheconfextrahttpd-vhosts.conf and include following Virtual host entry in this file.

With this entry our apache is listening to laravel.local, but we also have to edit our hosts file to include an entry for the new domain.

Laravel Virtual Host Xampp

Edit file C:WindowsSystem32driversetc and add following entry to that file.

Virtual

Restart your apache and access laravel.local on your browser you should be able to see this screen.

Have Fun working with Laravel !

Laravel Virtual Host Xampp

If you are looking for an updated tutorial that works with Laravel 5.8 and particularly gives details on setting up Laravel on Server checkout this tutorial -> Install Laravel.

Laravel Virtual Host Xampp Free

Done with Laravel Setup, Go ahead and move to next step with the following tutorials.