Saturday 21 October 2017

How to install The PHP Framework Laravel 5.5 in 5 simple steps on Xampp in Windows



5 simple steps to install Laravel 5 on Xampp in Windows  


Laravel is currently the most popular php-framework. It is an open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.  Other Php-frameworks are Symfony and Zend. Take the following simple steps to install the latest version of Laravel in any version of Windows whether Windows 7, Windows 8 or Windows 10.

Step1: The Laravel framework has a few system requirements. 


Check the following requirement.

  • PHP >= 7.0.0
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

  If you have Xampp already installed, then don’t worry because you got them already else Download Xampp 7.1.x and installed 


XAMPP Webserver


Step2: Download and install Composer

Composer is a PHP package manager that is integrated with Laravel Framework. In Windows, we can install it easy going to the official page and download the installer.
After install it, we can open a Windows terminal and write composer for execute the command:



Step 3: Configure Xampp VirtualHost

We will configure a VirtualHost (httpd-vhosts.conf) in Xampp for a Laravel project, and in this example, we want to configure the domain lara for our project.
By default, httpd-vhosts.conf   is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf 
Open it with preferably Notepad++ and add following lines at the end of the file:



# VirtualHost for Lara

<VirtualHost laravel.dev:80>

  DocumentRoot "C:\xampp\htdocs\laravel\public"

  ServerAdmin laravel.dev

  <Directory "C:\xampp\htdocs\laravel">

        Options Indexes FollowSymLinks

        AllowOverride All

        Require all granted

  </Directory>

</VirtualHost>








After this, our apache is listening to lara connections from the localhost. However, we need to configure our hosts file that allows to redirect lara to the localhost that is located. That takes us to the next step.

Step4 Configure the Host file

By default, host is located at  C:\Windows\System32\drivers\etc
Edit hosts file adding our localhost for lara:

# localhost name resolution is handled within DNS itself.

#             127.0.0.1       localhost

#             ::1             localhost

127.0.0.1              lara







Save the file and we are ready to install lara.

 

Step5: Install Laravel Framework

We are prepared to install and configure a Laravel Framework. First of all, we have to navigate to htdocs folder to install it and run this following command:

composer create-project laravel/laravel laravel "5.5.*"

Will start the installation of the Framework:



 Just be patient. No news is good news...



 How long it takes will depend on your network. Mine took about 30 minutes.




 When it finishes, it will create a folder called laravel in htdocs with the following structure:

Finally, restart Apache From Xampp Control Panel:


Restart Apache From Xampp Control Panel


Success!

Finally, Open your favorite browser and navigate to http://lara and Laravel it's installed!

Laravel Default Homepage



Should you encounter any challenge is installing the framework, please drop it at the comment otherwise, say hello everyone!

No comments:

Post a Comment