Monday, October 14, 2013

Complete Guide on how to Install Laravel 4 in Linux Ubuntu

Laravel 4 is out! What better way to test it than to install in my computer. I'll be teaching you how to install Laravel 4 in an Ubuntu OS. I like the current website of laravel, very classy. The documentation is more organized and readable. Anyway, let's get started!

Now, I've decided to install it using console. To install Laravel, we must first install Composer. Composer is a tool that will handle all the pre-requisites or dependencies of your application. If you have been coding using php for a long time, you'll realize this is a great tool. Makes migration easy.

Now, download a copy of the composer.phar from Composer website. Once you have the PHAR archive, you can either keep it in your local project directory or move to usr/local/bin to use it globally on your system. After which I renamed composer.phar to just composer.

Laravel requires mcrypt extension. Let's install that.
sudo apt-get install php5-mcrypt
To check if mcrypt is already includes in our php:
/usr/bin/env php --ri mcrypt
If you received an output of, "Extension 'mcrypt' not present". That means php doesn't recognize your mcrypt yet. To fix this, let's find out first what is your loaded php.ini. Then open the said php.ini file.
php -i | grep 'Configuration File'
Look for mcrypt section then add the codes below. Restart Apache by "service apache2 restart"
Now, another thing that Laravel requires is PDO.
sudo apt-get install php5-sqlite
sudo apt-get install php5-mysql
Again, lets open php.ini and look for pdo section and add the following codes below. Don't forget to restart apache.
Lastly, let's verify if everything that Laravel needs is there. Type "php -m". You should see the mcrypt and pdo in that list. If all is good, let's start extracting laravel in our folder.
composer create-project laravel/laravel --prefer-dist
Just wait for it and you'll have a copy of laravel in no time!

Note: If you're having problems because you can't use artisan, consider upgrading your php version to 5.4  as seen in my other blogpost.

Laravel Installation
PDO Class not found
PDO Class not found from Laravel Forum
Mcrypt Not present
Installing PDO extensions

1 comment:

  1. Installing Laravel on a hosting server is easier using Cloudways platform. You can use this platform to hosting laravel website on cloud in just few clicks. This platform provides configured managed servers with live chat support and server side support.