how to run php file by double clicking from any folder like html files in windows xp?


Is there any trick to run .PHP files in windows XP from any folder by double clicking like HTML file ?

I use XAMPP but in this we need to put files ina special htdocs folder. I want to run file from any folder, desktop by double clicking.

3/4/2010 5:59:33 PM

Accepted Answer

After searching a lot I found a easy way to do this

PHPScriptNet – Great portable application for those who learning PHP. PHPScriptNet can run your PHP script anywhere in Windows machine without installing PHP or any webserver.

php scriptnet

2/8/2017 2:11:41 PM

There is a significant difference in viewing HTML files vs. PHP files:

HTML files are static files interpreted by the browser. When you open them, the PATH to the HTML file is passes as an argument to the default browser which interprets and displays the file.

PHP files on the other hand are required to be interpreted by a PHP interpreter (XAMPP, in your case) before the resulting HTML is rendered by a browser. In this case, the local file PATH would have to be translated to the corresponding local URL, then sent to the browser.

Sample Solution
You could write a simple script that replaces '/var/www/' with 'http://localhost:8888/' (with a regular expression, for example) and passes that to the browser. Then, associate PHP files with your script.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow