Apache Friends' Xampp
- Download XAMPP.
- Install it to C:\www\xampp\ - At the end, click no to launching the XAMPP Control panel.
- If using a router, unblock ports 80 and 403. See screenshot to right.
After installing XAMPP, the first thing to do is to configure Apache itself. To accomplish this, load up Internet Explorer and enter C:\www\xampp\xampp\apache\conf in the address bar. In this folder, right click on httpd.conf and choose open. A new box pops up stating that Windows cannot open the file. Under the "What Do You Want To Do?" bubble the 2nd option by clicking inside the circle. Click OK.
After clicking OK, a new window opens with Internet Explorer being the recommended program to open this file. Scroll down a little, click on Notepad, and then choose OK.
The file then opens in Notepad. Note that many lines begin with the # sign. This just means that they are comments and don't do anything.
Using the Find tool under Edit, search for Listen 80. This line is responsible for setting the port the server will run on. Note: When you go to www.google.com, you are really connecting to port 80. If you use any other port, you'd have to connect to www.example.com:12300/.
Using the find tool again, find ServerName localhost:80. Replace localhost with your IP. If you need to find your IP, go to http://whatismyip.com/ After doing this, scroll down to the next line without a # sign infront of it. It should say "DocumentRoot". By default, it should be C:/www/xampp/xampp/htdocs. If you want to be able to host any file, it must go into this directory. Leave it set to the default. Now, go to File and choose save. Close Notepad.
Virtual Hosts allow one server to host many websites without having to run more than one server. For example, you could set http://example.com to use files from the example.com folder in HTDOCS, while http://example2.com uses files from the example2.com folder.
In order to setup a virtual host, paste C:\www\xampp\xampp\apache\conf\extra into Internet Explorer. Open the httpd-vhosts.conf file. In this file, they give a few examples of using virtual hosts. Near the bottom of the file, you will see two ## signs infront of the virtualhost command. Delete the # signs in this whole section. Now, inside the VirtualHost brackets, change the port but leave the "*:" in front of it. Remember to unblock this port later. Insert your email address to the right of "ServerAdmin".
Leaving the file open, load up Internet Explorer. Create a new folder by first typing C:\www\xampp\xampp\htdocs in the address bar. Next, right click on the white space, select new, and choose folder. Name the folder the port you set your virtual host to. Then, go back to the httpd-vhosts.conf file and set the documentroot to "C:/www/xampp/htdocs/foldername" including the quotes.
In the server name field, insert your IP address. Delete the ServerAlias line. Now, go back to Internet Explorer, and in the address bar, type C:\www\xampp\xampp\apache\logs. Here, copy and paste the original error and access logs. Now, right click on your copies, and choose rename. Rename your copy of the error.log to error1.log. Do the same thing for the access.log. After this is done, return to the httpd-vhosts.conf file, and insert "C:/www/xampp/apache/logs/error2.log" including the quotes into the "ErrorLog" field. Now, replace the whole "CustomLog" line to: TransferLog "C:/www/xampp/apache/logs/access2.log combined". Go to File and choose Save. Yay, we've set up a virtual host.
Setting Up MYSQL and PHP
Go to your desktop, and double click on the XAMPP Control Panel shortcut. Click start on MYSQL and Apache. If xampp doesn't display a green box to the left of apache's start, something is wrong with your apache settings. If this happens, check to see that everything is correct in the httpd.conf and httpd-vhosts.conf files. Now, it's time to see if your server is working.
Load up Internet Explorer, and type http://localhost/. If your server works, it will load up a page with the XAMPP logo with links below it. Click on the link named "English". A new page loads up. Look on the left side of the screen, and click on a link named "Security". On this page, XAMPP tells you that everything is unsecure. To fix this, scroll down past the table and click on the link named "http://localhost/security/xamppsecurity.php". On the next screen, set your MYSQL password to anything you desire. Note: the login name for MYSQL is root. After creating your desired password, check the box that asks to save your password in a plain text file. Incase you lose your password, just type C:\www\xampp\xampp\security in the address bar in Internet Explorer and double click on the "mysqlrootpasswd.txt" file.
Now, click on "Password Changing". MYSQL is now safe.
Scroll down, and create a username and password for the "XAMPP DIRECTORY PROTECTION". Remember to check the box that asks to save your password in a plain text file like we did for the MYSQL section. When finished, click on "Make safe the Xampp Directory". Congrats! Your XAMPP is now secure, and you can begin hosting files immediately by moving them into the HTDOCS folder.
Though there is much more to learn about XAMPP, this guide just covers the basics. To learn more, please visit ApacheFriends' site.