4 Jun 2013

How To Make My First Php Program And Run It.

For installation of PHP ..you can download wamp server from http://www.wampserver.com/en/  or http://www.php.net/manual/en/install.php

Let’s see how to make and run PHP code for the first time in your computer.


  1. If you are a beginner to use PHP for the first time on your computer, click on ‘File’ and select ‘Open’ from the drop down menu.
  2. Then select My computer from the left pane.  Select the hard drive C:. You would see ‘wamp’ folder in it and click on it. In this, select ‘www’ sub-folder. And this is within the folder all the PHP files.
  3. Double click on any of the existing test pages that are listed. You will see the code listed in the window. Then Click on ‘Run’ menu and select launch on your browser for example, if your browser is Firefox, you would see ‘launch in Firefox’ in the drop down box. Now click on the same option.
  4. Now it should display the result on the Browser existing in your computer. If you don’t get the result displayed on it, you need to do small changes. Type in the address bar that, ‘http://localhost/testpage.php’, testpage.php being an example of existing file name in the www folder. And then click on ‘Go’. Now you can see the result page of the PHP code that was already created.
  5. When you want to make a new PHP file, open Notepad++ application on the desktop or through the Programs.
  6. Click on ‘File’ and select ‘New’.
  7. Write down the simple code for PHP.
  8. Make sure it is saved in the same path of C:\wamp\www\your-php-file folder.
  9. Click on ‘Run’ menu and select ‘Launch in Firefox’. It makes your browser to open automatically and the results of PHP code would be displayed. If it is not done, make sure your address bar contains the file path of ‘http://localhost/<your file>.php’
  10. Do small modifications in the code, and see how the results are changed automatically when you run the code.
You can follow the below example for reference:



1) save above code as hello.php in dir c:\\wamp\www\hello.php
 2)goto browser and type :  http://localhost/hello.php

Out put :

hello buddy this is my first php code !


    Wish you a great PHP coding!

    No comments:

    Post a Comment