In this post, we will see how to install Laravel on Windows (WAMP server)!
Requirements:
Composer
Apache with mod_rewrite enabled
PHP >= 5.4
MCrypt PHP Extension
OpenSSL enabled
Steps:
1. Install Composer
2. Install Laravel via Composer
3. Configure virtual host on Apache
4. Edit host file inside ../system32/drivers/etc folder
5. Browse homepage.
Steps details:
You can skip step 1 if Composer already installed.
1. Install Composer:
To install Composer on windows OS please go to https://getcomposer.org/Composer-Setup.exe to download the setup file. Run the setup file to install Composer in your machine.
Please visit https://getcomposer.org/ to find out details about Composer.
2. Install Laravel via Composer:
Create folder laravelproject inside wamp/www folder. You can use your project name as folder name here.
Then open Git bash and then run following command to indicate your web root folder and install the project files.
cd c:/wamp/www/laravelproject composer create-project laravel/laravel --prefer-dist
It will take some time to execute the installation command. After successful completion, a success message will show on command screen.
3. Configure virtual host on Apache:
Go to Apache conf folder inside bin directory i.e. C:\wamp\bin\apache\apache2.4.9\conf and then open httpd.conf file. Comment ttpd-vhosts.conf line like following-
# Virtual hosts Include conf/extra/httpd-vhosts.conf
Then go to extra directory i.e. C:\wamp\bin\apache\apache2.4.9\conf\extra and then open httpd-vhosts.conf. Make changes like following-
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot "C:/wamp/www" ServerName localhost ErrorLog "logs/localhost-error.log" CustomLog "logs/localhost-access.log" common </VirtualHost>
<VirtualHost *:80> DocumentRoot "c:/wamp/www/lara/laravel/public" ServerName laravel.work <directory "c:/wamp/www/lara/laravel/public"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1 </directory> </VirtualHost>
4. Edit host file inside ../system32/drivers/etc folder:
Open Notepad as administrator and then open host file to add Laravel project path there. Browse C:/Windows/system32/drivers/etc path and open hosts file. Add following line there-
127.0.0.1 laravel.work
Save and close the file.
5. Browse homepage:
Go to browser address bar then write address laravel.work and reload the address.
For more details documentation please visit https://laravel.com/docs/4.2/installation
Enjoy exploring Laravel!
Leave a Reply