## Tuesday, February 7, 2012

### Installing PHP using WAMP on windows

I gave you brief introduction of Wamp Server in my previous article and link to download it. Now I am going to write how Wamp server can be used to run the PHP code on windows. Wamp basically contains three components : Apache, PHP and MySQL. Besides  it contains quick links for Localhost and PhpMyAdmin.  You can edit php.ini file as well as other many files using wamp server. It also has MySQL Console window (command prompt). WAMP server configures all the components for you so that you don’t need to configure each component manually.  Now lets install the wamp server first

Installation:

http://www.wampserver.com is official site for wamp server. Browse the site and download the wamp server. After downloading , just double click the executable file WampServer2.0i.exe (or any other version) and install it.

At the end of the installation , tick the check box start wampserver now . After you start wampserverm you will see a small icon  on the lower – right corner of desktop window. Click on the icon, a list of different files and folders like localhost, phpmyadmin, Apache, MySQLand PHP  pops up. Through this icon, you can put server online or offline, restart the services, edit the settings for PHP, see the versions of PHP , MySQL and Apache, jump to different directories and many more.

Testing the wampserver by running a sample php code.

Now wampserver is ready to use. Lets check  whether it is actually working or not. Open any web browser and type http://localhost or http://127.0.0.1 in URL Address bar. If wampserver is running, then a webpage is displayed (as shown in below) for you otherwise browser cannot find localhost.

Open C drive then you will see a folder named wamp. Inside wamp there is a folder called www. This is the folder where each PHP file must be kept in order to run them. If you place PHP files other than inside www, then the browser cannot find your files. Make a text file and rename the name of the file as test.php. Inside test.php write following code.

<HTML><HEAD><TITLE> Testing Wampserver </TITLE></HEAD><BODY><?php    echo "Hello world";?></BODY></HTML>

Save this file and type http://localhost/test.php one URL of the browser. Then you will see a webpage with Hello world written. This confirms that the server is working well on your computer  and you are ready to write a php code and run it.

#### 1 comment:

1. Thank you. This is the best example I've seen so far!