Saturday, January 4, 2014

Run & Test WAMP server

Running & Testing on WAMP server
In this section we will learn how to start, restart the WAMP server and test a simple php program. You will be familiarized with the WAMP server directories and the different configuration options it provides.
After successful installation you can see a folder inside the C:\ drive named wamp. Inside the folder there will be many files and folders like: alias, apps, bin, lang, logs, scripts, tmp etc. We will develop PHP programs inside the www folder e.g C:\wamp\www. Now start the wamp server either by double click on the icon appear on the desktop or go to start option and then select wamp server. After selecting the wamp server you can see an icon will appear (which looks like a speedometer of vehicle) on the tray (extreme right side of the task bar) as shown in the figure below.
 Initially the icon will be partially red, it means no service is currently running, click on it and a popup menu will appear, select the start all services option. Now the color of the icon should change to white that means all services are running, if the color of the icon appears half yellow then all services are not running then follow either of these steps:
  • Left click on the icon, select apache, go to service option, click start/resume service
  • Left click on the icon, select MySQL, go to service option, click start/resume service
Another option is left click on the icon and select restart all services.
To check whether the server is running or not again click on the icon of wamp server and select Localhost option. Home page of the server will be displayed in Internet Browser.  

Let's develop a small program to check whether your server is running or not.
Open the c:\wamp\www folder, create a new folder named PHP, and open a blank text file and write the following code:
<?="Hello PHP"?>
In the above code <?= ?> is an alternate of echo language construct, to enable this option click on the wamp server icon on task bar, select PHP, select PHP settings, and then check the short open tag option.   
Then save the file with any name and .php extension. Start the server, click on the localhost link, it will open the home page of the server and then click on the php link, it will display the list of  file name as link
Click it and it will display Hello PHP in the web browser.

No comments:

Post a Comment