Setup Menus in Admin Panel

  • No products in the cart.

  • LOGIN

Composer Installation and Running a Virtual Host

Go to this directory:

 

[email protected] MINGW64 /c/xampp/htdocs/Laravel_Project

 

Via Composer Create-Project:

 

Install Laravel by using the Composer create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel news_portal

 

After you hit enter in your terminal it will automatically start to download the required components in your project folder. In my case I have provided project name as news_portal, You can provide a project name in your wish. So it will create the project name as news_portal and install the required components. It will take a few minutes to install the components.

 

You will see the following screenshot:

 

 

 

Fig:Installation news_portal screenshot.

 

 

 Fig:Folder screenshot after a successful installation of project.

 

 

 

Local Development Server:

If you have PHP installed locally and you would like to use PHP’s built-in development server to serve your application, you may use the serve Artisan command. This command will start a development server at http://127.0.0.1:8000

 

php artisan serve

 

You will see the following screenshot if your project has been installed successfully.

 

Screenshot:

 

Fig:Screenshot after running a server

Note:
If your installation is completed then you can run the project through the local server but be sure you are in the directory /c/xampp/htdocs/Laravel_Project/news_portal
Otherwise, if you give the command in the same directory i.e /c/xampp/htdocs/Laravel_Project .Then you will get the following error.

 

Screenshot:

 

 

 

Why Local development server?

If you run the project through the local development server i.e http://127.0.0.1:8000 then it will directly point the following directory:

 

 C:\xampp\htdocs\Laravel_Project\news_portal\public

 

But if you are going to run the project manually then you have to enter the following path in your browser which is a lengthy process.

 

 C:\xampp\htdocs\Laravel_Project\news_portal\public

 

Note:

If you wish to stop the server then simply press Ctrl + c command.

 

 

 

Virtual Host:

You can run the project which is in your system through the virtual host also. So, in order to run the project through the virtual host, you have to configure the following:

 Step 1:

Go to C:\Windows\System32\drivers\etc path and you have to add the domain name. I have provided virtual host domain name as newsportal.test. In your case, you can provide any.

 

127.0.0.1       localhost
127.0.0.1       newsportal.test

 

Screenshot of notepad:

 

Fig:Adding a domain name screenshot

 

 

Step 2:

Go to C:\xampp\apache\conf\extra path and you have to add the following:

 

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/Laravel_Project/news_portal/public"
    ServerName newsportal.test
</VirtualHost>

 

After this configuration you have to restart your apache server(XAMPP server).

 

Screenshot:

 

Fig:Adding virtual host name screenshot

 

 

 

Fig:Screenshot after running a project in virtual host:

 

Note:
Running through the virtual host is the best option because it is not necessary to give the command like php artisan serve every time which is done in the local development server.

 

 

Attachments7

SEE ALL Add a note
YOU
Add your Comment
 

Advanced Course Search Widget

Popular Courses

Course Categories

© PHPhelp. 2002 - 2018 All rights reserved.
X