Step by Step Installation Laravel 5 On Ubuntu for Beginners – Laravel is different from other PHP framework, where you can download the master file fully and placed on your web server. Laravel has a dependence on some PHP library, where the library isn’t included in the laravel’s source. So we need to download the library separately.

Is laravel installation complicated ??

In my opinion, extremely complicated. This might be the first PHP framework I am trying to learn. Probably for those professionals who familiar with composer, lavarel installation becomes very easy. One of the interesting things of the laravel framework is about Composer. The whole requirement done by the composer, so any dependency with other libraries can be resolved by the composer. In other words, we don’t need to download one by one libraries needed by laravel. The principle is similar to apt-get in linux or NPM in nodejs. Because Composer is cool stuff, then there is no harm in us to install it first.

This article discusses how to install laravel on the ubuntu operating system, for Windows’s users, there could be some similarities, because using the composer.

How to install laravel 5 on ubuntu for beginners

In laravel official site has been described in detail how to install laravel 5 step by step. But still some starters like me failed to do the installation. Here are the steps :

Laravel need requirement as follows

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

Make sure you have fulfilled the above request

Install the composer on ubuntu / linux

How to install the composer on linux easy enough. According run the following script on the terminal ubuntu

php -r "readfile('');" > composer-setup.php

php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '41e71d86b40f28e771d4bb662b997f79625196afcca95a5abf44391188c695c6c1456e16154c75a211d238cc3bc5cb47') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

We will get composer.phar file in the directory where we run the script above

Please check with the command “php composer.phar” on terminal, if it looks like the image below, you have successfully perform the installation composer on ubuntu

How To Install Composer On Ubuntu Step By Step Install Laravel 5 On Ubuntu

So that we can use composer in any folder , please move the composer.phar to /usr/local/bin/composer

mv composer.phar /usr/local/bin/composer

For windows’s users please use the following links

Installation laravel 5

Please go to the web server folder ( cd /var/www/html/ ). Then run the following script to download laravel by composer

composer create-project laravel/laravel {directory} "~5.0.0" --prefer-dist


composer create-project laravel/laravel laravelApp "~5.0.0" --prefer-dist

Install Laravel 5 On Ubuntu Machine

Wait composer download files until completion. Then type ls on ubuntu terminal, you will find laravelApp folder that contains the complete file.

Then go to the laravelApp folder and run the command “composer update” to perform the update dependencies on laravel. But when doing the composer update, I had an error like below

- laravel/framework v5.0.9 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

Laravel Framework V5.0.9 Requires Ext Mcrypt

Don’t worry, you only need to install the ext-mcrypt on your php server. Here are the steps to install ext-mcrypt on php ubuntu :

sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart

If you’re windows user, i found link that can help you to resolve ext-mcrypt problems

Do the composer update again

composer update

Composer Update Step By Step Installation Laravel 5 On Ubuntu For Beginners

Installation laravel 5 has finished, please check on your browser http://localhost/laravelApp/public/

Check what happened? you will only be given a white screen on your browser. In order to run normally, we have to change the file permissions on the storage’s folder with code below

chmod -R o+w storage/

Change Permission Storage Folder On Laravel Step By Step Installation Laravel 5 On Ubuntu For Beginners

Check again on your browser and voila, You have successfully installed laravel 5 on your machine

Step By Step Installation Laravel 5 On Ubuntu For Beginners

Until this point we have managed to install laravel 5. Here are some of errors that occur when you install laravel 5, may be able to help solve your problem.

1. No folders vendor on laravel application

Laravel Installation Error Step By Step Installation Laravel 5 On Ubuntu For Beginners

PHP Warning: require(/var/www/html/laravelApp/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/laravelApp/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/html/laravelApp/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/laravelApp/bootstrap/autoload.php on line 17
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

Error Output: PHP Warning: require(/var/www/html/laravelApp/bootstrap/../v
endor/autoload.php): failed to open stream: No such file or directory in /v
ar/www/html/laravelApp/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/html/laravel
App/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/
share/pear') in /var/www/html/laravelApp/bootstrap/autoload.php on line 17

Solutions :

Please check the vendor’s folder in the ~/.composer/ and then copy the vendor’s folder to your application folder

Laravel Error Installation Vendor Folder Not Found

If no vendor’s folder in ~/.composer please run the following code at the terminal

composer global require "laravel/installer"

2. Error call to undefined method illuminate\Foundation\application::getCachedCompilePath().

Error Call To Undefined Method Illuminate Foundation Application GetCachedCompilePath Error Install Laravel 5

Solution :

Delete the vendor/compiled.php and run composer update again. Or also delete the storage/framework/compiled.php.

Hopefully the above tutorial can help you.

Thus article step by step installation laravel 5 on Ubuntu for beginners, hope useful

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

1 Comment

 Add your comment
  1. Holy cow dude, I want to kiss you! Thanks for this awesome guide!

    Something that I (A complete apache buffoon) ran into was this:
    The folder name in the /var/www/your_folder_name had to be /var/www/html to work. (Yeah, I know, I should configure apache) .

    Again, Many thanks!

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.