Sunday, 8 November 2015

How to Install Laravel 4 with an Apache Web Server on Ubuntu 14.04

Laravel is a open source PHP framework for web developers. It aims to provide an easy, elegant way for developers to get a fully functional web application running quickly.
Here we will dissuss how setup laravel step by step from scratch.
Preparing the server / environment
sudo apt-get update
sudo apt-get upgrade
Preparation of installing PHP 5
Installing Apache, PHP and MySQL
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
The installation process is self-explaining. You can prove the installed versions of PHP and Apache with:
php -v
apache2 -v
Installing necessary PHP extensions
sudo apt-get install unzip
sudo apt-get install curl
sudo apt-get install openssl
sudo apt-get install php5-mcrypt
Install Composer (systemwide)
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
Install Laravel 4
cd /var/www/laraveldev
wget https://github.com/laravel/laravel/archive/master.zip
unzip master.zip && cd laravel-master/ && mv * ../ && cd ..
rm -r laravel-master && rm master.zip

Make the storage folder writeable and restart the server:

sudo chmod -R 777 app/storage
sudo service apache2 restart
First run of Laravel 4
Now edit app/routes.php and add a new route:
Route::get(‘/mytest’, function() {
    return “Oh yeah, this really works !”;
});

Now you navigate to your the browser.
http://your-domain-or-ip/mytest

No comments:

Post a Comment