This tutorial will help a user to install Laravel5 a framework in php with the help of a composer.
The basic requirements to install Laravel5 are as mentioned below:
PHP >= 5.4
Mcrypt PHP Extension
OpenSSL PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
Run the below command to get the latest composer version
curl -sS https://getcomposer.org/installer | php
- For globally running the composer we can move composer.phar to the a path "/usr/local/bin/composer"
using the command:
"mv composer.phar /usr/local/bin/composer"
Test if the composer in working fine.
type in terminal=> "root@username:/var/www/html# composer"
Now we will install our laravel5 project.
select a directory in which we want to install laravel5
4.1> root@username: cd /var/www/html
4.2> root@username: /var/www/html# composer create-project laravel/laravel projectfolder_name
if laravel is installed successfully we will find the following message at last
Generating autoload files
Generating optimized class loader
Compiling common classes
Application key [wkB1eMQ7bUtbwKDCIWrfByhT2R9AyY8I] set successfully.
Laravel by default has a directory named public which is intended to be the document root of the web server.So we have to launch PHPs internal web server and say that the document root is the public directory of our Laravel installation.For this we need to
execute the below command:
root@username:/var/www/html# php -S localhost:8888 -t public
Understanding the above command in parts:
5.1>The php part is to run php in our project.
5.2>The "-S localhost:8888" part tells PHP to launch the internal web server at the address localhost on port 8888.
5.3>This means that we can open a browser and type http://localhost:8888 and we can see our Laravel 5 project.
5.4>The "-t public" part tells PHP that the web servers document root is the public directory.
1 Comment(s)