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
- First, download XAMPP for Windows Installer
- Then run the installer on your computer and make sure that your Windows firewall unblocks Apache.
- Run the Apache administrator.
- 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.
- 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.
- Navigate to C:\xampp\apache\conf\httpd.conf
- Open up httpd.conf in notepad and look for this line:
1#LoadModule rewrite_module modules/mod_rewrite.so
- Uncomment it so that it reads:
1LoadModule rewrite_module modules/mod_rewrite.so
- Next, search for AllowOverride None and change it to AllowOverride All.
- 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:
- 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:
12127.0.0.1 localhost::1 localhost
- Now add the following line to access your website locally via the URL myproject.dev (or any other URL you’d like):
1127.0.0.1 myproject.dev
- Finally, open the file C:\xampp\apache\conf\extra\httpd-vhosts.conf in a notepad editor, and add the following lines:
12345678910NameVirtualHost *:80<virtualhost *:80="">DocumentRoot "C:/xampp/htdocs"ServerName localhost</virtualhost><virtualhost *:80="">ServerName myproject.devServerAdmin webmaster@localhostDocumentRoot "C:\xampp\htdocs\myproject"</virtualhost>
That’s it! Hope you enjoyed the post!
i tried your solution and it worked, but then if I leave the coding you “NameVirtualHost *:80
Apache will not start. I have to comment it out to restart apache??
I have seen a quiz I would like to be able to run on my home PC xp windows PRO sp3
at
http://flesl.net/Technical/sample_quiz_code_e%20copy.php
I was hoping someone could show me how to do it using XAMPP as a local server.
The guy, Forrest Lunn, who made the site does not seem to be contactable
at contact at flesl dot net
thanks in Advance
Richard
Hi,
Awesome, I’ve been trying to figure out how to personalize my own local domain for ages. Although I’m a bit stuck at the moment.
The first problem I had is when I entered the code you put for virtual host, apache won’t start. I’ve already edit that one and just created one virtual host instead and it works.
Second problem is when I put “http://myproject.dev/myproject”, it says object can’t be found but if I put “http://localhost/myproject” it shows the page. Not sure what’s going on. For my project, I’m using MediaWiki. Hope you can help. Thanks in advance.
-Hakim
Thank you for your post.
I have just fixed my problem.
😀
hello friends,
how to start xampp folder in lan computer?
i am install xampp on my computer. and setup wordpress
but i am statr this setup other computer in my lan network
plz help how tho start one xampp other lan computer?
Help
I cant change well save my hosts file! permissions not available?
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
also myphpadmin error
Error
MySQL said:
#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)
Connection for controluser as defined in your configuration failed.
Just did this command!-
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/.
Thank you but i typed in my browser http://sayefsufal.com but they showed to me like
Under Construction
The site you are trying to view does not currently have a default page. It may be in the process of being upgraded and configured.
Please try this site again later. If you still experience the problem, try contacting the Web site administrator.
If you are the Web site administrator and feel you have received this message in error, please see “Enabling and Disabling Dynamic Content” in IIS Help.
To access IIS Help
Click Start, and then click Run.
In the Open text box, type inetmgr. IIS Manager appears.
From the Help menu, click Help Topics.
Click Internet Information Services.
Hello,
try to edit the file
C:\Windows\System32\drivers\etc\hosts
as you suggest under window 7, I have “Open Error” message, I change the
permission of the file to have full control for the “users”, but still have the
“Open Error” message, please help!
Best regards
Tony.
Hello,
I cannot open C:\Windows\System32\drivers\etc\hosts, I try to start notepad with as administrator and then try to open the file, I still have “open Error” message on my Window 7 computer, please help!
Thanks in advance.
Tony.
very nice tutorial thanks to share with us 😉
this was so good!
Hi, thanks a lot for this good explain about XAMP.
I am trying to write some codes for designing my webpage for Internet Quizzes. it’s my final project.
your guidance helped me a lot. thanks again.
Cannot save the host file. It says make sure the path and filename are correct???
Thanks for your useful information’s
After I try to do all this, when I start my apache again I receive this message “Apache service stopped” busy…”Apache service started” busy…. and repeat…
So Why my apache can’t start after change all this things?
i have done it ant it working on the server but when i type the url on another machine on the same lan it gives me an error server not found. please help me
Nice tutorial. Thank you for posting it.
My brain doesn’t do well with inferring and so I’m having trouble figuring out a couple of the steps:
* … make sure that your Windows firewall unblocks Apache. (How do I tell if it did that? I’m running Norton Internet Security. Do I need to check it also or instead of Windows firewall?)
* Run the Apache administrator. (What is that exactly? How do I run it?)
Thanks
xampp web server setup errors detected for windows 7 Enterprise OS
Pls help me
What will I do if localhost:8888 was error??????
I am not able to open my MyPhpAdmin:(