My .bashrc file is all set and I’m now able to continue use the terminal commands. This is how I fixed the issue:
How To Install Laravel Framework in Ubuntu?Laravel5.7, PHP7.1.26
This blog will be a step by step guide to install Laravel, a most popular Framework of PHP. Blog also includes all possible issues that you will face during the installation along with their troubleshooting methods.
- Ubuntu – I’m using 16.04LTS for the Laravel Setup. You can install it in higher version of Ubuntu Releases too.
- PHP 7.1.3
- Composer – It’s a bundler or wrapper that makes installation easy collecting all necessary PHP Packages for you
- Laravel Installer – It will install Laravel for you.
- Laravel Framework 5.7 – The Installer will fetch and install this framework.
First, Install PHP in your Ubuntu. Check the link below to know how to install PHP or get the required version from a Personal Package Archive(PPA)
Second, Install Composer from your Linux Terminal. You can easily download composer by typing following command in Terminal: sudo apt install composer.
To check if the installation is completed without any error type composer in your terminal and hit enter. The installation is complete if a list of parameters/commands are displayed in terminal.
Third, get your Laravel Installer via composer. Install the laravel installer in a global scope such that you can use it in any file folder of your local file directory.
sudo composer global require laravel/installer
Make sure that you have added the laravel execution path in your system variable. This is an easy step and this is how you do it:
How to set $PATH variable in Linux?
If you are going through the steps, your setup is complete. Now we have two options to install the framework. Either with Laravel or with Composer. I will show commands for installing Laravel Framework via both ways. But I did my installation using Laravel command in terminal.
Enter the following command from your terminal:
laravel new appname
Prefer your own appname. This will create a folder of your appname and will install all packages and configuration of Laravel Framework. You can than check your composer.json file. The Laravel Framework is shown something like this: “laravel/framework”: “5.7.*”
You can also create your new proejct via composer. To do so you need to use following command:
composer create-project --prefer-dist laravel/laravel appname
If everything goes well now you have your project set. I will list possible error that you will encounter here in the link below:
Few PHP extensions might be missing during the installation. Link below will provide steps to install those extensions.
Now you won’t get any error. Go through the logs and install missing extensions.
Run The Localhost Server
After this you are ready to run your localhost server to check if the app we created using Laravel is working or not.
php artisan serve
There are chances of facing another issue: require(vendor/autoload.php): failed to open stream. Follow the link below to solve this error:
If every packages and configuration are installed till this step, you have your app up and running at http://127.0.0.1:8000
Your installation is set. You will see a page with Laravel and some menus in the index page.
Facing 500 Internal Server Error?
This is the last issue you will encounter during the installation of Laravel. Go through the blog post below and find out how to solve this.