Reputation: 1742
In order to run a PHP file using XAMPP, the php file must be saved within C:\xampp\htdocs\new_folder, I was wondering if there is anyway to run PHP by being able to save the PHP file anywhere on my computer and run it by just clicking on it (e.g. location:Desktop).
Upvotes: 0
Views: 172
Reputation: 14003
Following solution if you want to run them in your browser, not just with php.exe
You can define a new host in your hosts file, e.g. test.intern for your localhost, than in your apache httpd.conf set up a virtual host (with e.g. your desktop as destination), and you can run your php file in your browser with your new host as url:
test.intern/yourPhpFile.php
Detailed manual you can find here:
http://sawmac.com/xampp/virtualhosts/
PS: Starting it with doubleclick may be a little tricky, but I just found a solution here: http://forum.wampserver.com/read.php?2,62530,112860
They do it by creating a shortcut from their browser on their desktop, and add some startparameters to it, so that it directly navigates to host/youPhpFile.php
, but I don't think you really want to do this.
Upvotes: 1
Reputation: 155
Short answer is that there isn't a great way to do this, but here are some (rather clumsy) options:
How to run a PHP file on my computer that is outside the htdocs directory?
Upvotes: 0
Reputation: 1478
your files are being run not by xampp but by php.exe file :) if you click php file and choose "open with" and then pick that executable you will be able to run that script (although you could not see any output from that script so real question is: why you want to do this?)
Upvotes: 0