Reputation: 6998
Trying to mess around with PHP, but I don't want to install IIS or Apache and was hoping for a small interpreter that I can pass the scripts to and have them run in like a console or something. Much like Lua does. Does this exist? When I go to download PHP it seems to only talk about running it on IIS or Apache.
Upvotes: 0
Views: 5270
Reputation: 14070
PHP can be used on the command line. Just download and extract the executable.
Running can be done 3 ways: a file, supplied code or in an interactive shell
php file.php
php -r "echo 'hello';"
php -a
You can also install a pre-packaged server (e.g. XAMPP) or run your code online on various places (e.g. phpfiddle.com)
Upvotes: 8
Reputation: 14959
With PHP 5.1+ you have an interactive shell too:
launch php with -a parameter
php.exe -a
http://php.net/manual/en/features.commandline.interactive.php
Upvotes: 2
Reputation: 8620
dtech's answer seems most fitting for the simple script-running things you're looking for. If you decide you want an actual web-server, with as little setup as possible, look at "XAMPP".
Upvotes: 0
Reputation: 9302
Alternatively, you can write your PHP scripts as you would normally (with some limitations),
And use the following command line:
C:\php.exe -f "D:\phpFile.php"
Upvotes: 0
Reputation: 3441
I believe that PHP v5.4 comes with its own webserver built-in. Install that version and you should be fine. Though I really would like to know why you have problem with installing Apache (IIS sucks though).
EDIT: As a few others have said, you can run PHP from the command line.
Upvotes: 0