Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

How to setup a PHP-MySQL App on Apache server on Windows – using WAMP Server

Posted on September 2, 2024

WampServer is a free, open-source web development platform that allows users to create and test web applications locally on their Windows computer. It’s a self-contained package that includes everything needed to run web applications, including:

  • Apache (web server)
  • MySQL (database management system)
  • PHP (programming language)
  • phpMyAdmin (database administration tool)

Key Features:

  • Easy to install and configure
  • Allows for testing and development of web applications offline
  • Includes latest versions of Apache, MySQL, and PHP
  • Supports multiple versions of PHP
  • Includes phpMyAdmin for easy database management
  • Can be easily switched on and off

Common Uses:

  • Web development and testing
  • Local hosting of websites and web applications
  • Testing and debugging of web applications
  • Learning and training in web development

1) Install WAMP Server

WAMP Server Download: https://wampserver.aviatechno.net/?lang=en

2) Clone or download the app to your Webserver location

C:\wamp64\www\<your_app>\

3) Apache Configuration for Virtual Hosts:

On Windows: Open the Apache configuration file httpd-vhosts.conf located at:

C:\wamp64\bin\apache\apache2.4.54.2\conf\extra\httpd-vhosts.conf

Add your virtual host configuration.
Remember to change your_app with the name of your app and yourapp.local with your desired domain name.
Here’s an example configuration:

<VirtualHost *:80>
    DocumentRoot "C:/wamp64/www/your_app"
    ServerName yourapp.local
    <Directory "C:/wamp64/www/your_app">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/your_app_error.log"
    CustomLog "logs/your_app_access.log" common
</VirtualHost>

Edit the Main Apache Configuration File:

  • On Windows:
    • Open the Apache configuration file httpd.conf located at C:\wamp64\bin\apache\apache2.4.54.2\conf\httpd.conf.
    • Ensure the following line is uncommented (remove the # at the beginning if present):
    Include conf/extra/httpd-vhosts.conf

Restart Apache: Go to the WAMP Server Control Panel and restart the server.

4) Setup the Host file entry

To make the virtual host work on your local machine, you need to map your custom domain to localhost in your hosts file.

Edit the hosts File:

  • On Windows:
    • Open Notepad as an Administrator (right-click on Notepad and select “Run as administrator”).
    • Open the file C:\Windows\System32\drivers\etc\hosts.
  • Add the following line:
127.0.0.1 yourapp.local

Save the file and close Notepad.

5) Setup the App DB in MySQL

  • Access phpMyAdmin:
    • Open a web browser and go to http://localhost/phpmyadmin.
  • Create a Database:
    • Click on the “Databases” tab.
    • Enter a name for your database and click “Create.”
  • Import the Database (your_app.sql):
    • Select the database you just created.
    • Click on the “Import” tab.
    • Choose the SQL file and click “Go.”

6) Verify Configuration

  • Access Your Local Application:
    • Open a web browser and navigate to http://yourapp.local.
    • You should see your application if everything is set up correctly.
    • Note that this domain will resolve only on your local machine because of the host file entry.
  • Check for Errors:
    • If you encounter issues, check the Apache error log for clues.
    • Look in C:\wamp64\www\your_app\logs\error.log

Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme