Install latest version of Laravel using composer in linux OS with the help of terminal [Easy Method]
To create the project in laravel first we need to install the following things in our system:
- php
- php-cli
- php-zip
- curl
- composer
- laravel installer
Let's install laravel from scrach:
Open your terminal
Update your system using command "sudo apt-get update"
Now install the latest version of php in your system using command "sudo apt-get install php"
Now install php-cli in your system using command “sudo apt-get install php-cli”
Now install php-zip in your system using command “sudo apt-get install php-zip"
Now install “curl” in your system using command “sudo apt-get install curl”Now latest version of Composer is installed in your system, To check it simply type “composer” and hit enter
Now lets install laravel in your system, to do that type “composer global require laravel/installer” and hit enter, it’ll start installing the latest version of laravel installer in your system, using the composer that we've downloaded.
Make sure to place Composer's system-wide vendor bin directory in your
$PATH
so the laravel executable can be located by your system. To do that, open the ".bashrc" (hidden file) of your system using “nano .bashrc” & hit enter
Simply add the highlighted text
(export PATH=”$PATH:$HOME/.config/composer/vendor/bin”) after “esac” , as shown below.
And the latest version of laravel installer is completely installed in your system, To check it simply type the command "laravel" & hit enter
Now to create your first project in laravel, first choose the directory where you want to create your project & just simlpy type "laravel new projectName" and hit enter, It'll start downloading the project template for you
ITS ALL DONE!
Now you can run your project by typing command "php artisan serve" from the root directory of your project.
And then your project will start running on local host,
But
in rare case it w'll say error while you try to run "php artisan serve" and falied to run the project and say PHP Warning, PHP fatal error like below:
To fix this error simply type command "composer update --ignore-platform-reqs" and hit enter from the root directory of your project
It'll 100% fix this that error and you can able to run your project using command "php artisan serve"
And you want to know more about laravel just comment below:
Thank You!
0 Comments