How to setup a local web server on your computer using XAMPP

Web development work should always be done locally. When developing a website, all the development work should be done on a local LAMP Stack environment installed on your computer. That way, the production time is greatly reduced and you can fully test your work before launching.

When you are completely done developing your project, the migration to the live server is seamless. Here are the simple steps to install a local server on your PC to easily develop websites.

This article applies to the installation on Windows 98, NT, 2000, 2003, XP and Vista, of Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.

Installing XAMPP on your computer

  1. First, download XAMPP for Windows Installer
  2. Then run the installer on your computer and make sure that your Windows firewall unblocks Apache.
  3. Run the Apache administrator.
  4. Open your browser and go to http://127.0.0.1 – If all went well, a screen will appear where you can choose your language.
  5. Go to http://127.0.0.1/security/xamppsecurity.php and setup a password (it ill be used for your databases), and click on “Password Changing”.

Congratulations! You’re done! Now put your website’s files in a new directory under C:\xampp\htdocs\ (if you installed xampp in C:\xampp). For example: C:\xampp\htdocs\myproject\; and setup your databases using PHPMyAdmin located here http://127.0.0.1/phpmyadmin/.

Configuring Mod Rewrite

To finalize your installation, and make your development work much easier, go through the following steps to enable Mod Rewrite. This enables you to use fancy permalinks without the index.php appendage.

  1. Navigate to C:\xampp\apache\conf\httpd.conf
  2. Open up httpd.conf in notepad and look for this line:
  3. Uncomment it so that it reads:
  4. Next, search for AllowOverride None and change it to AllowOverride All.
  5. Restart Apache by typing services.msc in either the command prompt or Start Search prompt in Vista.

Personalized Domain for your Local Environment

I’ve set my local environment to mimic my live environment as much as possible. For example, to access the local environment for my blog, I type this in my browser (https://www.richardcastera.com). Here is how to set that up for each project:

  1. Navigate to C:\Windows\System32\drivers\etc\ and open the host file in a notepad editor. Make sure the following lines are written in the file:
  2. Now add the following line to access your website locally via the URL myproject.dev (or any other URL you’d like):
  3. Finally, open the file C:\xampp\apache\conf\extra\httpd-vhosts.conf in a notepad editor, and add the following lines:

That’s it! Hope you enjoyed the post!

Share: