Seocheckout

How to run a PHP file on your browser?



Write the reason you're deleting this FAQ

How to run a PHP file on your browser?

If you open a HTML file using your browser, it will open fine. However, this is not the case with PHP because PHP needs to be processed on a web server. If you open a PHP file with your browser, it will show your PHP code. In order to open a PHP file using your browser, you need to download a local web server. A few examples are MAMP, XAMPP and WAMP.

How to run a PHP file on your browser?

Once you downloaded a web server, you will need to put your files in your working folder. Normally, it is either “public_html” or “htdocs”. However, it can be something else. Once you put your files in that folder, go to localhost/filename.php if the name of your file is filename.php. Before, you do that make sure your web server is online (don’t make the mistake I did).

Comments

Please login or sign up to leave a comment

Join
MendasDigital
Great post. I would also add that the PHP software itself has a built in webserver feature (accessed with the -S option), which can be useful if you just need to quickly test a page in your browser.



Are you sure you want to delete this post?

overcast
I have used BITNAMI. As that stack is lot better compared to the apachefriends XAMPP. You have to just install it and let the services run. Once the services start running, you can easily get to do the stuff. You can't easily run PHP files on browser though unless you are running any PHP based servers. Running such servers would allow you to run PHP file through localhost.



Are you sure you want to delete this post?