PHP 5.4 – Built-in Web Server

The CLI SAPI provides a built-in web server for development purposes – extremely helpful to quickly start  testing your php pages. Just enter the following on the command line and you are ready to go.

The server will now be listening to your requests on port 8000.

php -S localhost:8000

Which will display the following:

PHP 5.4.0 Development Server started at Fri Apr 06 13:56:26 2012

Listening on localhost:8000

Document root is C:\php-5.4.0

Press Ctrl-C to quit.

Of course don’t expect something along the lines of Apache or IIS. This is a small built-in service that lets you quickly check your pages. Absolutely not recommended to use on a production basis.

Leave a Reply

Your email address will not be published. Required fields are marked *

*