Is there any way to test PHP locally without installing a server?

Ben Leggiero picture Ben Leggiero · Feb 1, 2014 · Viewed 91.1k times · Source

I'm looking for something like http://phpfiddle.org/, but completely local. I don't want to commit to installing something as complex as Apache, then PHP on top of that, just to try out code when I'm offline. Is there anything that can run PHP 5.5 on the local machine without installing an entire server underneath it?

Answer

Eugen Dimboiu picture Eugen Dimboiu · Feb 1, 2014

There's no need for a server if using PHP 5.5+ - it has a built-in server (http://www.php.net/manual/en/features.commandline.webserver.php)

Just use:

$ cd ~/public_html
$ php -S localhost:8000