- Linux Installed System.
Laravel 5.5 requires PHP version 7 or more, and some other extensions. Since we are doing setup on XAMPP. Make sure to Install the XAMPP with version >= 7.0.0 .
First of all we need to download and install XAMPP for Linux. Download it from the apache friends official website. Download the XAMPP version > 7.0.0 which contains PHP version 7.0.0
Follow the steps for XAMPP installation. For Linux Ubuntu or Mint Distro, the default installation directory for XAMPP is /opt/lampp
Use coupon 5balloons on this Cloudways Affiliate URL to get special discount.
Once the XAMPP is installed you should be able to access its manager console.
If your XAMPP is correctly installed and apache web server if turned on in the manager console, You should see this page when you access localost in your browser.
Once you are done with XAMPP it’s now time to setup Composer.
Composer is a dependency management or package management tool which is integrated with Laravel Framework. Check by running composer command in your terminal if your system has composer already installed in it. If not you can install it by running the following commands on your terminal.
sudo apt-get update sudo apt-get install curl php5-cli git curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Install Laravel Framework
The default directory of XAMPP for installing or keeping PHP project is htdocs. Navigate to following directory in your terminal /opt/lampp/htdocs and run following composer command to create a fresh Laravel 5.5 version
composer create-project laravel/laravel myProject "5.5.*"
After running this command composer should start downloading dependencies that are required to create the Laravel project.
When it finishes it will create a Laravel 5.5 project with following data structure.
Modify Directory Permissions
In the newly created Laravel Project we need to modify the directory permissions of certain directory otherwise we will get following error on accessing the project
The stream or file “laravel.log” could not be opened: failed to open stream: Permission denied.
- cd into your Laravel project.
- sudo chmod -R 777 storage
- sudo chmod -R 777 bootstrap/cache
XAMPP Virtual Host
We need to configure XAMPP Virtual Host to set the document root to correct directory of laravel project and to also assign a name to the project by which we will be accessing it in browser.
Navigate and open file /opt/lampp/etc/httpd.conf file and uncomment the line that includes the virtual host file.
# Virtual hosts Include etc/extra/httpd-vhosts.conf
Navigate and open file /opt/lampp/etc/extra/httpd-vhosts.conf and include following Virtual host entry in this file.
# VirtualHost for laravel.home <VirtualHost laravel.home:80> DocumentRoot "/opt/lampp/htdocs/authproject/public" ServerAdmin laravel.home <Directory "/opt/lampp/htdocs/authproject"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
With this entry our apache is listening to laravel.home, but we also have to edit our hosts file to include an entry for the new domain.
Edit file /etc/hosts and add following entry to that file.
Restart your apache and access laravel.home on your browser you should be able to see this screen.
Done with Laravel Setup, Go ahead and move to next step with the following tutorials.
- Connecting Laravel Project to Database.
- Laravel Authentication Tutorial [Login, Logout, Register, Forgot Password & Remember Me Functionality]
- Installing Laravel Collective Package on Laravel 5.5
- Tutorial – Simple CRUD Operations in Laravel 5.5