PHP Classes
PHP Classes
elePHPant
Icontem

How to Install Laravel 5 Framework on Ubuntu

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Install Larave...   Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)  

Author:

Posted on:

Categories: PHP Tutorials

This tutorial is about how to install and use the Laravel using Composer in Linux Ubuntu operating system.





By Praful Kumar India

<email contact>

Introduction

Laravel is an Open Source PHP framework designed for the fast development of MVC Web applications in PHP. This article will help you to install Laravel 5 PHP framework on Ubuntu operating systems.

Installing Composer

I assume PHP, Apache and MySQL are already installed on your environment.

First you need to install Composer PHP tool. Composer is required for installing Laravel dependencies.

Use the commands below to download and use Composer command in your system.

1. Just execute the below command to install Composer:

$ curl -sS https://getcomposer.org/installer | php

2. Move Composer to bin folder:

$ sudo mv composer.phar /usr/local/bin/composer
3. Set file execution permission

$ sudo chmod +x /usr/local/bin/composer

Installing Laravel

4. Now install Laravel: To download latest version of Laravel, Use below command to clone master repo of laravel from github.

$ cd /var/www/html/
$ git clone https://github.com/laravel/laravel.git
Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.
$ cd /var/www/html/laravel
$ sudo composer install
Dependencies installation will take some time. After than set file permissions.

$ chown -R www-data.www-data /var/www/laravel
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/app/storage
5. Generate and set Encryption Key: Now set the 32 bit long random number encryption key, which used by the Illuminate encrypter service.
$ php artisan key:generate
Application key [yOHTFu3Bc1Kr7Ykqed4Gt6nmW3S0ZC917=] set successfully.
6. Now edit config/app.php configuration file and update above generated application key as followings. Also make sure cipher is set properly.
'key' => env('APP_KEY', 'yOHTFu3Bc1Kr7Ykqed4Gt6nmW3S0ZC917'),
'cipher' => 'AES-256-CBC',

Configuring Apache

7. Create Apache VirtualHost: Now add a Virtual Host in your Apache configuration file to access Laravel framework from web browser. Create Apache configuration file under /etc/apache2/port.conf (may be different for other OS) directory and add below content.
$ vim /etc/apache2/ports.conf
<VirtualHost *:80>
ServerName laravel.prafulkr.in
ServerAlias laravel.prafulkr.in
DocumentRoot /var/www/html/laravel/public/
<Directory /var/www/html/laravel/public/>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
FileETag MTime Size
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</Directory>
ErrorLog /var/www/logs/systempk.log
</VirtualHost>

Starting the Application

8. Restart apache server:
$ sudo service apache2 reload
Now open the Web server page in browser and let's start building an awesome application using Laravel 5 PHP Framework.




You need to be a registered user or login to post a comment

1,460,522 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

FacebookGmail
HotmailStackOverflow
GitHubYahoo


Comments:

1. storage - Nicu Guliman (2017-04-19 07:10)
composer instalation didn't created storage folder... - 0 replies
Read the whole comment and replies



  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Install Larave...   Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)