0

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).

1
  • 2
    you can associate .php files with php.exe, if xampp's installed the CLI copy of php. Commented Jun 4, 2013 at 19:42

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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?)

Comments

0

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.