We help IT Professionals succeed at work.

Associating a default application for PHP files

ddantes asked
I have installed WampServer so that I can test PHP files on my local drive without needing to upload them to my server.  This is a big help.  However, I still need to move these files to my local root directory, launch a browser and navigate to the localhost file index.  I wonder if there is a way to configure a default application for the PHP file extension, so that the file is opened in the virtual server, wherever it resides on my local drive?
Watch Question

Dave BaldwinFixer of Problems
Most Valuable Expert 2014
No.  PHP needs the server resources to operate like it does on your internet server.  Without that, PHP is a command line application, not a page in a web browser.

software like phpdesigner do have a "run" option  if that could be of any help.
To my knowledge the best way to run it is through an apache and a browser.
You may also start with something really simple like just making the webfolder on your local machine your "code" folder.

ie, instead of keeping your sources in, say, c:\my_php_projects, just keep it in a folder that is inside of your webroot, eg, c:\wamp\htdocs\my_php_files. So in essence, when you make changes to the files, you do so "directly" on your localhost server, and simply keeping a browser window open that is always pointing to localhost/my_php_files will require just a quick refresh to see your changes....

Do you have a php.exe?  If so, it should take <any file name> as an argument, so:

C:\>php myfile.php

This is how it works with the php-cli in the Unix environment, with which I'm far more familiar, but I don't see why it would be any different.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.