Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP 5.4 Will Have a Built-in Web Server

DZone's Guide to

PHP 5.4 Will Have a Built-in Web Server

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

Yet another new feature to look forward to in PHP 5.4.0 - the CLI SAPI will now provide a built-in web server which is geared toward developmental purposes.  It shouldn't be used in production right now. 

According to the page on this feature, which was updated today:

"URI requests are served from the current working directory where PHP was started, unless the -t option is used to specify an explicit document root.

If a URI request does not specify a file, then either index.php or index.html in the given directory are returned. If neither file exists, then a 404 response code is returned.

If a PHP file is given on the command line when the web server is started it is treated as a "router" script for the web server. The script is run at the start of each HTTP request. If this script returns FALSE, then the requested resource is returned as-is. Otherwise the script's output is returned to the browser."  --php.net



Go check out the examples over on docs.php.net:





Source: http://docs.php.net/manual/en/features.commandline.webserver.php

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}