ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming»
  • Programming Languages

How to run PHP Code or PHP Scripts and See the Result on Your Browser

Updated on June 1, 2013

How to test and run PHP code or PHP scripts on your browser?

This hub will show you on how to run simple PHP code on your browser using XAMPP and Notepad++. You can make your own php code or try other php code examples. You can also try my php code example on the given links at the end of this hub.

Steps on Running a PHP code or PHP scripts on your own browser.

1. Download PHP editor preferably Notepad++. (Assuming you do not have a Notepad++)

2. Install Notepad++

3. Download XAMPP for free. (Assuming you do not have a Notepad++)

4. Install XAMPP

5. Open XAMPP

Example XAMPP Photo When Openned

6. Run the Apache and My SQL on the XAMPP window by clicking "Start Button"

Example Photo When My SQL and Apache are Running

7. Open Notepad++ or Netbeans as a PHP editor

8. Copy and paste the code below to Notepad++ or any other PHP editor you have.


echo "This is just an experiment <br/>";

echo "Try other php code sample and see how it works!";


9. Save the file with any name and with .php extension. Example: filename.php

10. Save it on the drive where you installed the XAMPP, for example, in my case, it is on Drive C

Example Photo of XAMPP Folder in Drive C

11. open the XAMPP folder on Drive C or on the Drive where you installed it.

12. Find and open the "htdocs folder" inside the XAMPP Folder

Example Photo of "htdocs" folder inside the XAMPP Folder

13. Then click save. Make sure that the PHP fie is saved on the htdocs folder.

14. Now go to your browser

15. Then type this on the address bar: localhost/yourfilenamehere.php Replace "yourfilenamehere" with the file name you made when saving the file.

16. Hit enter.

The result must be like this:

If you have any clarification or question about the steps, please do not hesitate to ask in the comment section.


    0 of 8192 characters used
    Post Comment

    No comments yet.