Skip to main content

How to install Laravel on Ubuntu

To install Laravel you must have install LAMP stack (Linux, Apache2, MySql, and PHP) on your Ubuntu system

Install LAMP: If not installed LAMP

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install mysql-server

sudo apt-get install php5-mysql


Install PHP extensions
Some PHP extensions are necessary to install before installing Laravel

1. unzip used for the unzip laravel
sudo apt-get install unzip

2. Use Composer (which needs CURL)
sudo apt-get install curl

3. Use Composer (which downloads via HTTPS, usable only with install Openssl)
sudo apt-get install openssl

4. Use Laravel 4 (which needs mcrypt)
sudo apt-get install php5-mcrypt


Install Composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Activate mod_rewrite

sudo a2enmod rewrite

sudo service apache2 restart

Open the default vhost config file:

sudo nano /etc/apache2/sites-available/default

Now search for "AllowOverride None" then change to "AllowOverride All"


System Requirement for Laravel
  • PHP >=5.4 for Laravel 5 and PHP >=5.3 for Laravel 4
  • mcrypt PHP extension

Install Laravel

Goto your web root directory
cd /var/www

Method 1: Install via laravel installer
composer global require "laravel/installer=~1.1"

Note: Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.

To set PATH use following command
export PATH="~/.composer/vendor/bin:$PATH"

Then create new laravel project using laravel new {project-name} command
for example: laravel new blog. It will create a new laravel project directory in your web root directory.

Method 2: Install laravel using composer create-project command in your terminal
composer create-project laravel/laravel {directory} {laravel version} --prefer-dist

for example: composer create-project laravel/laravel blog 4.2 --prefer-dist
Note: Mention version number to install specific Laravel version. If you don't mention it then it will automatically install the latest version. The latest version of laravel is 5.
If you don't mention dirctory then it will install in "laravel" by default.

Method 3: Install via download
Download the Laravel framework and extract the content into your web root directory.
Next, in the root of your Laravel application, run the php composer.phar install (or composer install ) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.

Final Step : If you are using LAMP or MAMP, you need to give permission to storage folder (i.e. for Laravel v5.x, folder path is /storage, permission command is $sudo chmod -R 777 storage)

After setting permission run project either use laravel CLI tool (Artisan) or set virtual host.
1. By CLI tool type in console $php artisan serve
2. For setting virtual host refer this link http://tecadmin.net/install-laravel-framework-on-ubuntu/






Comments

Popular posts from this blog

Main menu dropdown parent item clickable in Drupal 8 using Bootstrap 4

 Edit menu--main.html.twig template file {# /**  * @file  * Bootstrap Barrio's override to display a menu.  *  * Available variables:  * - menu_name: The machine name of the menu.  * - items: A nested list of menu items. Each menu item contains:  *   - attributes: HTML attributes for the menu item.  *   - below: The menu item child items.  *   - title: The menu link title.  *   - url: The menu link url, instance of \Drupal\Core\Url  *   - localized_options: Menu link localized options.  *   - is_expanded: TRUE if the link has visible children within the current  *     menu tree.  *   - is_collapsed: TRUE if the link has children within the current menu tree  *     that are not currently visible.  *   - in_active_trail: TRUE if the link is in the active trail.  */ #} {% import _self as menus...

Add JS to the bottom of the page in Drupal 7

How to add JS at bottom of a particular page in Drupal 7 Step 1: Get the page id. In case of front page "is_front"  Step 2: In template.php file of your theme add the below code : function illume_preprocess_page(&$variables) { if ($variables['is_front']) { drupal_add_js(path_to_theme().'/js/util.js', array('type' => 'file', 'scope' => 'footer')); drupal_add_js(path_to_theme().'/js/main.js', array('type' => 'file', 'scope' => 'footer')); drupal_add_js(path_to_theme().'/js/slideimage.js', array('type' => 'file', 'scope' => 'footer')); $variables['bottom_scripts'] = drupal_get_js(); } } This way you can add JS file using drupal_add_js() and define scope as footer. Step 3: Now you can use bottom_script variable to the page tpl file where you want to add JS print $bottom_scripts;

Use Case Diagram for Online Book Store