0

Possible Duplicate:
How to run php files on my computer
Is it possible to run .php files on my local computer?

Well, sorry if this is a "newbie" question but I have to do it:

How can I open a .php file? I've saved a test.php file and now I want to open it... Do I need to use Apache?

Community
  • 1
  • 1
Daniel Montenegro
  • 1,491
  • 2
  • 15
  • 15

3 Answers3

4

You need to have Apache running on your system. Once it's running, open up your browser and type in localhost/test.php in the address bar. This is assuming that test.php is in the correct location.

If you install WAMP, the correct location will be something like C:\wamp\www. In addition, once WAMP is installed you can just click on the WAMP tray icon and then click "www directory" which will open the correct location into which you will place test.php.

If you don't have Apache/PHP installed, you can download WAMP which installs those and MySQL all in one, automatically: WAMP Server

reformed
  • 4,505
  • 11
  • 62
  • 88
3

If you mean to run a PHP script then yes you would need Apache or any type of web server that supports PHP. If you want to run your scripts locally on your computer you can install XAMPP and and run your computer will act like a web server. Just enter http://localhost/ in your browser to get the homepage when it is installed. Comment if you have any issues or another question. :)

EDIT: XAMPP is available accross almost every platform including Windows, Mac, and Linux

You can grab XAMPP from it's website at http://www.apachefriends.org/

Stephen Cioffi
  • 1,161
  • 2
  • 13
  • 32
1

php -f /path/to/test.php

If you are on linux and PHP is installed.

Mike Mackintosh
  • 13,917
  • 6
  • 60
  • 87