- When I started playing around with PHP I noticed that php files can not be opened by a web browser the way HTML files do. HTML and CSS are rendered by the browser.
- In other words browsers know all that it takes to load and display an HTML page with or without CSS.
- When while browsing internet and whenever you visit a PHP file your browser make a request to a web server to interpret the PHP script. After receiving the request server takes the PHP scripts and run them, and then take the response and send it back to your browser.
- Your browser can then understand and handle the response send to it by the server. This how you get to see the PHP file on your browser while browsing internet.
But what about the situation where you are developing a website using PHP and you want to interpret php files locally on your PC
How to run php file in windows
- So if you are developing a website I am sure you have an access to web server where you are hosting your website but surely you do not want to upload your file or project to web server again and again while developing and testing your website. So you need a local installation pf PHP on your machine.
- PHP is not pre-loaded on every computer like web browsers are but it is easy to download PHP from the Internet, get it working on your computer and all that for free. Most of the easiest and best and easiest tools for writing PHP code are also free.
- I have read many books and articles on web where people recommend WampServer Installation but I have installed Easyphp Dev Server on my computer.
- I find it easy to install and it is also portable. You can also install it on removable disk. So this is what I have installed and I find it particularly easy to install and use.
- You can install any program you find like installing and working with.
- I am not really going into steps of installing this program as the one I use is really easy just few clicks and you are done. So now I had prepared my PC for interpreting files nest comes a text editor that you can use for writing and editing PHP file.
- There are many editors available you can begin with your notepad or word-pad that comes with your PC or you can try Komodo edit or sublime text they both are great and good for general purposes like editing and writing your PHP files and scripts.
I hope this makes the things little clear. Please do provide the feedback on how to run php file in windows