Apparently, you can start a temporary server with Python, by using:
python -m SimpleHTTPServer
Is there a way to do this for PHP and Apache? e.g. one command which will serve the current folder as the localhost? On Mac.
You can start PHP development server in versions 5.4 and above with:
php -S localhost:8008
I don't think Apache supports anything similar (being itself a web server), but PHP dev server is enough for testing scripts, including serving static contents.
PHP 5.4 added a simple web server to the PHP cli. You can start it with php -S <addr>:<port>
it will serve the current directory on address <addr>
over port <port>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With