๐Ÿš€ How to Start a Laravel Project (With XAMPP, phpMyAdmin, and Ubuntu Setup)

๐Ÿš€ How to Start a Laravel Project (With XAMPP, phpMyAdmin, and Ubuntu Setup)

Laravel is one of the most popular PHP frameworks used for building modern web applications. If you're just getting started, this guide will walk you through setting up a Laravel project from scratch, explain its folder structure, configure the .env file, and connect your project to a database using phpMyAdmin. Weโ€™ll use XAMPP on Ubuntu as the local server environment.


โœ… Step 1: Install Laravel on Ubuntu

First, make sure your system is ready with the required tools:

๐Ÿ“ฆ 1. Install PHP and Composer


sudo apt update
sudo apt install php php-cli php-mbstring unzip curl php-xml composer


๐Ÿ“ฆ 2. Install Laravel Installer (Optional)


composer global require laravel/installer


Make sure the global composer vendor/bin directory is in your PATH. You can add this to your ~/.bashrc or ~/.zshrc:


export PATH="$HOME/.config/composer/vendor/bin:$PATH"



โœ… Step 2: Create a New Laravel Project

There are two ways to create a Laravel project:

๐Ÿ”น Using the Laravel Installer:


laravel new myproject


๐Ÿ”น Using Composer (if you didnโ€™t install the Laravel installer):


composer create-project laravel/laravel myproject


This will create a new directory called myproject with all Laravel files.


โœ… Step 3: Understand Laravel Project Structure

Hereโ€™s a quick overview of the main folders:

  • app/ โ€“ Contains your application logic, models, and controllers.

  • bootstrap/ โ€“ Starts the Laravel framework.

  • config/ โ€“ Holds configuration files.

  • database/ โ€“ Migrations, seeders, and database-related stuff.

  • public/ โ€“ The entry point for the app (index.php). Place your frontend assets here.

  • resources/ โ€“ Views, assets (CSS, JS), and localization files.

  • routes/ โ€“ All route definitions (web.php, api.php, etc).

  • storage/ โ€“ Log files, compiled views, and file uploads.

  • tests/ โ€“ Automated test files.

  • .env โ€“ Environment configuration file (we'll talk about this next).


โœ… Step 4: Configure .env File

The .env file stores environment-specific settings. Open .env inside your project folder and update the following lines for database configuration:


APP_NAME=Laravel
APP_URL=http://localhost/myproject/public
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_db
DB_USERNAME=root
DB_PASSWORD=


Note: The DB_PASSWORD is empty by default for XAMPP.


โœ… Step 5: Set Up XAMPP and phpMyAdmin on Ubuntu

๐Ÿ“ฅ Install XAMPP:

Go to https://www.apachefriends.org/index.html and download the Linux installer.

Run these commands:


cd ~/Downloads
chmod +x xampp-linux-x64-*.run
sudo ./xampp-linux-x64-*.run


๐Ÿš€ Start XAMPP:


sudo /opt/lampp/lampp start


Access phpMyAdmin at:


http://localhost/phpmyadmin


๐Ÿงฑ Create a Database

  1. Visit phpMyAdmin.

  2. Click New.

  3. Create a database named laravel_db (or anything you used in .env).


โœ… Step 6: Serve Your Laravel Project

Inside your project folder, run:


php artisan serve


Youโ€™ll see something like:


Starting Laravel development server: http://127.0.0.1:8000


If you want to use XAMPPโ€™s Apache instead, move the Laravel project to /opt/lampp/htdocs:


sudo mv ~/myproject /opt/lampp/htdocs/


Then access it via:


http://localhost/myproject/public



โœ… Bonus Tips

๐Ÿ” Permissions

If you face permission errors on storage/ or bootstrap/cache/, fix it with:


sudo chmod -R 775 storage bootstrap/cache



๐ŸŽ‰ You're Ready to Build with Laravel!

You now have a fully working Laravel environment on Ubuntu using XAMPP and phpMyAdmin. From here, you can start creating routes, controllers, models, and build your dream web application.

Isaac Talb

Startup Co-Founder | Software Engineer | Football Player

Leave a Reply

Your email adress will not be published, Requied fileds are marked*.