Installing Laravel PHP Framework on Ubuntu 16.04 for Apache Server

Installing Laravel PHP Framework on Ubuntu for Apache Server

Wiki Laravel is a free, open-source[3] PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern and based on Symfony.

Install on Ubuntu 16.04

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1 php7.1-mcrypt php7.1-xml php7.1-gd php7.1-opcache php7.1-mbstring
sudo apt-get install apache2 libapache2-mod-php7.1

cd /tmp
curl -sS | php
sudo mv composer.phar /usr/local/bin/composer

sudo add-apt-repository –remove ppa:ondrej/php

cd /var/www/html
sudo composer create-project laravel/laravel YOUR_PROJECT –prefer-dist

sudo chgrp -R www-data /var/www/html/your-project
sudo chmod -R 775 /var/www/html/your-project/storage

cd /etc/apache2/sites-available
sudo nano laravel.conf

<VirtualHost *:80>
ServerName localhost

ServerAdmin [email protected]
DocumentRoot /var/www/html/your-project/public

<Directory /var/www/html/your-project>
AllowOverride All

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

sudo a2dissite 000-default.conf
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart

sudo apt-get install php-common php-mysql php-gd mysql-server
(put a mysql password)

mysql -u root -p
than create user laravel with password laravel

CREATE USER ‘laravel’@’localhost’ IDENTIFIED BY ‘laravel’;
GRANT ALL PRIVILEGES ON * . * TO ‘laravel’@’localhost’;

mysql -u laravel -p
create database testapp;

cd /var/www/html/your-project
sudo nano .env


sudo service apache2 restart

sudo php artisan migrate

sudo php artisan serve

See laraver default page here


Leave a Reply

Your email address will not be published. Required fields are marked *