Author: Praful Kumar
Viewers: 728
Last month viewers: 2
Categories: PHP Tutorials
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/composer3. 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/Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.
$ git clone https://github.com/laravel/laravel.git
$ cd /var/www/html/laravelDependencies installation will take some time. After than set file permissions.
$ sudo composer install
$ chown -R www-data.www-data /var/www/laravel5. Generate and set Encryption Key: Now set the 32 bit long random number encryption key, which used by the Illuminate encrypter service.
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/app/storage
$ php artisan key:generate6. Now edit config/app.php configuration file and update above generated application key as followings. Also make sure cipher is set properly.
Application key [yOHTFu3Bc1Kr7Ykqed4Gt6nmW3S0ZC917=] set successfully.
'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 reloadNow 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,616,107 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
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