Search code examples
phplocaltestbed

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


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?


Solution

  • 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