ABOUT ME & Why XAMPP?
Hi! My name is Jared Heinrichs. I am just starting out programming with PHP. I am using a book called “Learning PHP 5” by O’Reily Press. So far the book has been great. I had been using WAMP and it had served me just fine until I needed “require ‘db.php’;”. db.php is a file which is part of PEAR that allows you to connect to different types of databases using the same syntax. This makes porting your code easier.
XAMPP is a great piece of software that does most of the configuration for you. It allows you to create a developer workstation quickly and easily. It also provides all the items that you would ever need while developing PHP code. Here’s a list of the items that XAMPP provides as of version 1.6.8
• MySQL
• PHP
• Perl
• FileZilla FTP Server
• phpMyAdmin
• OpenSSL
• Freetype
• Webalizer
• mod_perl
• eAccelerator
• mcrypt
• SQLite
• Mercury Mail Transport System
• fake sendmail for windows
• FPDF Class
Wow!! All that in one small 25MB download.
SETUP
You will want to download XAMPP right from the source. You can find it here:
XAMPP Download
XAMPP pretty much is a next, next, next type of install. When installing on Vista how ever you do not want to install to the “Program Files” directory. This how-to article will be done on a Windows Vista Home Premium Laptop. Most of the steps here could be replicated on a Windows XP machine. Just remember that in XP the “users” directory starts with “Documents and Settings” where as on Vista the users directory is actually called “Users”.
As stated before there are a couple of things I am going to take for granted.
1. You are running Windows Vista
2. You will be installing to C:\users\%username%\XAMMP
Please change “%username%” every time you see it with your own user folder.
One thing that XAMPP doesn’t do nearly as well as a competing piece of software called WAMP is creating alias’s or Virtual folders. Virtual folders in WAMP are so easy to create. Searching the net I didn’t find much help on this subject. Using WAMP I was able to see how it’s scripts did things and I am going to show you how to replicate it. I personally think the way that WAMP set things up is incredible and it easily allows you to remove items.
You are going to need to make a new folder in:
C:\Users\%username%\XAMPP\apache
This folder will be called “alias”. This is where you will be putting in all your alias “.conf” files. Each of the files will be named the same as the “alias” plus the “.conf” extension.
I will show you an example of creating an alias. The alias will be called “training” and it can be accessed by going to:
http://localhost/training/
Remember you will be creating all these files in:
C:\Users\%username%\XAMPP\apache\alias
Create a file called :
training.conf
Edit training.conf – It will look something like this.
Alias /training/ "C:\Users\jared\Documents\PHP training/"
<Directory "C:\Users\jared\Documents\PHP training/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
** Note this will eventually allow apache to have the alias http://localhost/training/ that will really be pointing to the files in “C:\Users\%username%\Documents\PHP training/”
The next thing you want to do is to let apache know that you have created this alias directory. To do this open httpd.conf in:
C:\Users\%username%\XAMPP\apache\conf\httpd.conf”
At the very end of the file add this one line:
Include “C:/Users/%username%/xampp/apache/alias/*”
** Note – Although Windows tends to use \’s normally, in the Apache httpd.conf file you need to use /’s.
Any time you change the httpd.conf file you need to restart the apache server. You can do it several ways. You can either restart “Apache” in the Windows Vista services section or in the XAMMP control panel. Use the way you find easiest to remember.
TROUBLESHOOTING
Although XAMPP is very easy to setup, the program tends to allow relatively novice users like myself install items without having to advance knowledge of things like apache and setting up php. When things go wrong how do you fix them?
I found that I’ve seen with apache comes from 2 things. Firewall settings and previous installs of apache/WAMP that leave things lying around in the services section in Windows.
One thing to note before installing XAMPP is that you go into services and make sure that “Apache” and “MySQL” are not currently in the list. If they are I’d first go to the Add/Remove programs and make sure that those programs aren’t listed. If they are any remnants still there please un-install them. Go back to services and refresh the screen using F5. If it still isn’t removed right click on “Command Prompt” and tell Vista to run as administrator. Type “sc delete name_of_service”.
For example I had to remove an old version of apache by typing “sc delete apache”. You will get a confirmation if it was successful or if it failed.
If you go into the XAMPP control panel and services just don’t seem to want to run make sure that you go into Windows SERVICES. Find the service that just won’t start… Right click it and tell it to start. This will then force the software to run. If there hasn’t been a port added the firewall exception list like port 80, Windows will prompt you to allow it to open that port. Tell it “Yes” you would like to open the port.
[…] on your local development machine and not have to worry about manually setting up. I’ve written a How to Install XAMPP with Pear on another blog post. Check it […]