- Computers & Software»
- Computer Science & Programming»
- Programming Languages
How to run PHP Code or PHP Scripts and See the Result on Your Browser
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.
PHP Code Examples and Tutorials
- How to become a PHP Developer: Learn and Earn
- Steps on How to Program in PHP: A Beginner's Guide on PHP Programming-Part 1
- HTML Basics: Learn The Basics of HTML and Create Your Own Webpage on Your Browser
- PHP Sample Codes On Function:How to make Function in PHP
- PHP Code Example on Associative Array and Multidimensional Array
- PHP Code Example on Numeric Array
- PHP Code Example on Switch Statement:Making Choice and Cases
- PHP code Example for if statement
- PHP Code Example for if-else Statement With Notepad++
- PHP Code Example on if else-if Statement
- PHP Code Example on While Loop
- PHP Code Example on Do-while Loop
- PHP Code Example on Foreach Loop and For Loop