Wednesday, February 18, 2015

How to install Laravel 4.2 on Lubuntu

Hello everyone, welcome back to my blog, in this episode i will show you how to install laravel 4.2 on lubuntu linux.

In case you didn't know, laravel is one of the most popular php framework, so if you are php programmer you might be interested to use laravel.

Alright, to install laravel 4.2 on lubuntu is pretty simple, keep in mind that laravel 4.2 requires at least php version 5.4.

I'm using lubuntu 14.04 trusty and the php version that i have is 5.5.9, so it should be safe, to find out what php version you have, type this command:

php -v

php -v
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:42)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

So here's step by step how to install laravel 4.2 on lubuntu:
  • install php cli, by typing this command:
sudo apt-get install php5-cli
  • install mcrypt (needed by laravel for encryption), type this command:
sudo apt-get install php5-mcrypt

sudo php5enmod mcrypt
  • install composer on your lubuntu
download the composer.phar by typing this command:
curl -sS | php
and then copy the composer.phar to bin directory for global access:
sudo mv composer.phar /usr/local/bin/composer
  • once composer installed, we can create laravel project via composer, using this command:
composer create-project laravel/laravel=4.2 [project_name] --prefer-dist
for example the project name is myfirstweb, then simply type:
composer create-project laravel/laravel=4.2 myfirstweb --prefer-dist
  • wait until composer finish creating the project, once finish, go to that directory by typing:
cd [project_name]

in this case the project name is myfirstweb, so type:

cd myfirstweb
  • inside that folder/directory type the php artisan serve command, like this:
php artisan serve
  • now open your favorite web browser and go to http://localhost:8000/
  • congratulation you have just create your first laravel project :)

No comments:

Post a Comment