How I Set Up Laravel Without XAMPP – Complete Step by Step Guide (PHP, Apache, MySQL)
Oct 06, 2025
142 views

How I Set Up Laravel Without XAMPP – Complete Step by Step Guide (PHP, Apache, MySQL)

About Author

S

Shahidullah Khobaib

Author & Developer

Article Summary

Summary

  • PHP and Apache installed manually, fully controlled.
  • Apache can be started, stopped, or restarted via CMD.
  • Test PHP with index.php and Apache serves index.html by default.
  • Laravel or PHP projects can be placed in any drive/folder, not limited to htdocs.
  • MySQL installed and configured easily via official installer.
  • Laravel runs smoothly without XAMPP.
This setup gives full control, better performance, and real-world server experience for Laravel developers.

Article Content

Most beginners use XAMPP for Laravel because it bundles everything: PHP, Apache, and MySQL. But XAMPP can be heavy and less flexible. I wanted full control over my development environment, so I installed PHP, Apache, and MySQL manually.

This guide explains step by step how to:

  • Install PHP & Apache
  • Configure PHP & Apache 
  • Test Apache and PHP with It Works!
  • Configure MySQL
  • Run Laravel or PHP projects from any folder or drive without restrictions.


Step 1 : Download PHP

  1. Download PHP from the official website:
     👉 PHP Downloads
  2. Choose the Thread Safe ZIP version.
  3. Extract it somewhere convenient, e.g., C:\Server\php. 


Step 2 : Download Apache

  1. Download Apache from:
     👉 Apache Lounge
  2. Extract it to a folder, e.g., C:\Server\Apache24.


Step 3 : Configure PHP

  1. Rename php.ini-development in PHP folder to php.ini.
  2. Open it and enable required extensions:
extension=curl
extension=fileinfo
extension=gd
extension=gettext
extension=intl
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
extension=openssl
extension=pdo_mysql
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=sodium
extension=sqlite3
extension=xsl
extension=zip


Add PHP to Windows Environment Variables 

Copy your PHP installation path for example:

C:\Server\php
  1. Press the Windows key (or click Start) and type: 
  2. search for environment variables
  3. If you see “Edit environment variables for your account”, that works too. Click the result. 
  4. In the System Properties window that opens, go to the Advanced tab and click Environment Variables…
  5. Under System variables (recommended) select Path and click Edit
  6. Click New and paste:
C:\Server\php
  1. Then save:

Check PHP:

Open Terminal:

php -v
PHP 8.3.22 ...
If you see the version then it works.


Step 4 : Configure Apache to Use PHP

Edit C:\Server\Apache24\conf\httpd.conf and add:

# PHP Setup
LoadModule php_module "C:/Server/php/php8apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/Server/php"

DocumentRoot "C:/Server/Apache24/htdocs"
<Directory "C:/Server/Apache24/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

The htdocs folder contains index.html by default.

Step 5 : Start, Stop, and Restart Apache via CMD

  1. Open Command Prompt as Administrator.
  2. Navigate to Apache bin folder:
cd C:\Server\Apache24\bin
  1. Install Apache:
httpd.exe -k install
  1. Start Apache:
httpd.exe -k start
  1. Open your browser and visit:
http://localhost
Congratulations!
If you see “It Works!” in your browser, Apache and PHP are working correctly. You can now move on to running PHP or Laravel projects.


Optional!

If you want to start and restart the Apache follow the below commands.

  1. Stop Apache:
httpd.exe -k stop
  1. Restart Apache:
httpd.exe -k restart


Step 7 : Run Laravel

  1. Install Laravel via Composer:
composer create-project laravel/laravel myproject
  1. Laravel project can be placed anywhere — C:\Server\Projects, D:\LaravelProjects, etc.


Step 8 : Download and Install MySQL

Download the official MySQL installer:
 👉 MySQL Installer

  1. Run the .msi installer.
  2. Select Developer Default or Custom installation.
  3. Set the root password.
  4. Finish installation.
MySQL will be installed as a Windows service — no need to move it to the Server folder.


Add MySQL to Windows Environment Variables 

Copy your MySQL installation path for example: 

C:\Program Files\MySQL\MySQL Server 8.0\bin
  1. Press the Windows key (or click Start) and type: 
  2. search for environment variables
  3. If you see “Edit environment variables for your account”, that works too. Click the result. 
  4. In the System Properties window that opens, go to the Advanced tab and click Environment Variables…
  5. Under System variables (recommended) select Path and click Edit
  6. Click New and paste:
C:\Program Files\MySQL\MySQL Server 8.0\bin
  1. Then save:

Step 9 : MySQL Configuration

  1. MySQL was installed via official installer and runs as Windows service.
  2. Open MySQL Workbench or CMD and connect:
    • Host: localhost
    • Port: 3306
    • User: root
    • Password: (your root password)
  3. Create a database for Laravel or PHP projects:
CREATE DATABASE laravel_db;
  1. Update your Laravel .env file with the database details:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_db
DB_USERNAME=root
DB_PASSWORD=yourpassword
 If this guide helped you, don’t forget to share it with your friends and follow me for more tips and tutorials!