Tuesday 15 June 2010

Using XAMPP To Develop PHP Projects

When beginning PHP development there are many tools you need to start your projects. One of the most important is a working server with Apache and MySQL. One of the ways you can do this is by purchasing your own server environment on-line with all these facilities set up for you. However this has the draw back of you using an FTP client every time you wish to preview your work. This is particularly tiresome if you're working on a big project. Therefore there have been several pieces of software set-up to emulate a server environment on your own PC. The two main ones I have encountered are:
  • XAMPP
  • WAMPS
I experimented with WAMPS sometime ago but found the software most difficult to set-up and never fully got it working. XAMPP however I use today and find it incredibly easy to install and update, I've even used it in conjunction with Windows Server 2003 with great success.

In this guide I will show you how to set-up XAMPP and a little bit on using PHPMyAdmin for your PHP projects.

XAMPP Installation Guide

  1. To start with you will need to visit http://www.apachefriends.org/en/ and navigate to the XAMPP WINDOWS download link. I'm going to install the .exe version.
  2. On download completion open up the set-up program.
  3. Choose an install directory (defaults to C:/xampp) and then click install.
  4. When the set-up program has finished extracting a command prompt window will pop-up and ask you a series of questions. I shall list the questions and answers below:
  • Should I add short cut to start menu/desktop? Yes (if you need to)
  • Should I make a portable XAMPP with drive letters? No
  • And confirm the time zone
XAMPP should now be successfully installed onto your PC. To test it open the application control panel (located on your desktop or start menu) and then select "Start" on both Apache and MySql. You can also install these to run as services
, meaning that they'll always be running in the background making it ideal for a static server. For development purposes however you may as well just stop and start the services when you need to through XAMPP Control Panel. If XAMPP is installed properly both the services will start-up successfully and say "Running".

To confirm all the services are running correctly open up one of your web browsers (I advise Google Chrome simply because it's fantastic) and then type in 'http://localhost/'. This should open the XAMPP web page which confirms it's working.

IMPORTANT!

If you've had any problems installing XAMPP please let me know and I'd be happy to try and help however I've come across my own problems when installing XAMPP in the past.

The first of which is when having Skype installed to your PC.

See this guide to resolve this issue - http://drupal.org/node/275924

There have also been problems when installing certain Windows Vista updates.


So now that's installed you can begin your PHP development!

--See next post for 'Beginning PHP Development'