To develop in PHP or run any program, application or Content Management System built using PHP, one needs to have a server, PHP interpreter software itself and most likely a database too. All these are readily available for after purchasing a live web hosting plan on a live server. Now what if you’re not ready to go live with your development project or what if you just intend to do some practice.
Well, the other option you have is to setup a local server on your computer. And then maybe when you’re ready to go live, you can then upload your files to the live server on the web. There are a number of ways to set up your local testing and development environment. Personally I use WAMP a popular software which stands for Windows Apache MySQL and PHP. This stand-alone program comes with everything you need to set up a development environment. That is, the server, database and the PHP interpreter software.
Here’s what you need to do:
Step 1: Download the WAMP Server Files
You can download a free copy of WAMP at http://www.wampserver.com/en, you can find the download section about half way down the page or by clicking on the “DOWNLOAD” link in the main menu. Depending upon our computer either download the 32 or 64 bit download. If you not sure you can check the system type under Control Panel->System and Security->System.
Step 2: Install WAMP on your computer
After you have downloaded your WAMP Server it’s time to install. Go to your downloads folder and double click on the the .exe WAMP file you just downloaded, and select “run” and follow the install prompts
After the install is complete you will be able to see the files located at C:/wamp/ or your custom install directory, if you changed it from the default setting.
Step 3: Starting Your WAMP Server for the first time.
Ok, you now have the WAMP software installed, but in order to begin using the server we need to start it. Just like any program you can either use one of the icons you created during the installation process or look under Start->All Programs->WampServer folder and click on “startWampServer”
After starting your WAMP server an icon will appear in your task bar. You will see it in 1 of 3 states.
- Red, meaning no services on your WAMP server are currently running (when you first start the server it will be red, don’t panic, let it boot up.
- Orange, meaning the WAMP server has been started, but not all of the services are running (again don’t panic, as the server starts it will transition from red to orange to green)
- Green, meaning the WAMP server has been started and all it’s services are running correctly
As the server starts up it will go from red to orange to green, it shouldn’t take more than a minute. If it seems stuck on either red or orange you may need to reboot the server, or “Restart all Services”.
Step 4: Verify Your WAMP is Working
If everything went according to plan and you have a “Green” WAMP icon you can now visit the url http://localhost and you should see the following:
Congratulations, your now have a fully functioning local development server setup and running! You can now add html files, php files, xml files, directories, etc to your www folder and they will be visible from your browser via http://localhost/yourdirectory, http://localhost/filename.php, http://localhost/your-directory/filename.php, etc. and behave as though they are on a live web server.