Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run .php files on my local computer? [duplicate]

Tags:

Possible Duplicate:
PHP server on local machine?

Is it possible to run .php files on my local computer? I know if i open up a web browser and enter the file location into the URL for HTML files, the html file will run and display. Is there a way to do the same with .php files?

like image 335
Steven Rogers Avatar asked Feb 16 '12 20:02

Steven Rogers


People also ask

How do I run a PHP file in a local computer?

php” file is placed inside the “htdocs” folder. If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.

Can you use PHP locally?

The preferred way of running PHP files is within a web server like Apache, Nginx, or IIS—this allows you to run PHP scripts from your browser. That's how all PHP websites work! The other way is to run PHP scripts on the command line, and it doesn't require you to set up a web server.

Can you run PHP without server?

You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.


2 Answers

Sure you just need to setup a local web server. Check out XAMPP: http://www.apachefriends.org/en/xampp.html

That will get you up and running in about 10 minutes.

There is now a way to run php locally without installing a server: https://stackoverflow.com/a/21872484/672229

like image 177
AlienWebguy Avatar answered Sep 27 '22 20:09

AlienWebguy


Yes but the files need to be processed. For example you can install test servers like mamp / lamp / wamp depending on your plateform.

Basically you need apache / php running.

like image 20
moxy Avatar answered Sep 27 '22 21:09

moxy