How to create a Laravel 4.2 project

This guide assumes you have installed a LAMP server. The steps for correct installation of Laravel 4.2 project are:

sudo curl -sS | php
sudo mv composer.phar /usr/local/bin/composer
sudo a2enmod rewrite
sudo php5enmod mcrypt
sudo service apache2 restart

All commands above is executed once and all commands below is executed as many times as you create new projects.

cd /home/{user}/public_html
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
cd /home/{user}/public_html/{directory}
sudo chmod -R o+w app/storage
sudo chmod -R o+w app/storage/logs
sudo nano /etc/apache2/sites-available/

The content should be like below:

<VirtualHost *:80>
DocumentRoot /home/{user}/public_html/{directory}/public
<Directory /home/{user}/public_html/{directory}/public>
AllowOverride All
Require all granted
ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ combined
LogLevel warn

sudo a2ensite
sudo service apache2 reload
sudo nano /etc/hosts

Add this line below after localhost

Go to your favorite browser and type: If you can see the ‘You have arrived’ message, it means you have installed a Laravel 4.2 application successfully.