PHP Echo Tutorials

XAMPP for PHP and MySQL

Written by phpecho.com   

If you have ever tried to install a web server and configure it, you will know the complexities involved. If you are one of those people who want to use PHP and mySQL and are not worried about the intricacies about how web servers work, then you should opt for a XAMPP installation.

XAMPP is an Apache distribution that makes working with PHP, mySQL and Perl a breeze. What is more, it is an easily installable software. Once you set up XAMPP – which could be as simple as downloading and extracting – your LAMP setup is ready for use.

Downloading and Setting Up XAMPP

In order to download XAMPP, visit the Apache Friends site at www.apachefriends.org/en/xampp.html. Here you will multiple distributions. Download the Windows distribution. At this point, you will have the option to either download the installer version or the ‘non-installer’ version. If you download and install the first option, then the installer will update the registry with the installation details. In the second option, all you need to do is to extract the distribution into a folder of its own. Again, when you want to remove XAMPP, just remove this folder. In case you have installed XAMPP, you will need to uninstall XAMPP like for other Windows programs.

In case you decided to use the non-installer version of XAMPP, then you will need to perform an extra operation. Execute the setup_xampp.bat file which will update the configuration paths. In case you use the installer version, then this step is not needed.

Now your LAMP setup is ready to use. The servers can be started/stopped using the corresponding batch files (usually named xampp_start and xampp_stop). You can also use the gui provided for the same purpose.

Using XAMPP

Now that the XAMPP setup is completed, it is time to write your first program and execute it. The programs should be copied into the htdocs folder available in your XAMPP installation. You can choose to create sub folders inside the htdocs folder. To access your program, just type the name of the file with location relative to the htdocs folder.

A very common issue that comes up when using XAMPP in Windows is that the server does not start. This usually happens when the XAMPP port is being used by another application. If you face a similar problem, check for other applications that access the internet or block access to the internet. Typically, a internet firewall application can block the port and prevent the server from starting. To resolve this, disable the firewall while you start the server. You can then re-enable the firewall.

Some other applications like Skype also prevent the server from starting. The solution is the same – close the application while starting the server.

If you need more support on using XAMPP, you can refer to the documentation available on the Apache Friends site at http://www.apachefriends.org/en/faq-xampp.html.