php -S is a development server and nothing more

The CLI binary in 5.4 will serve HTTP, which turns “reproduce this on the branch I just checked out” from a vhost, an Apache restart and a line in /etc/hosts into one command run in the directory. The name it goes by in the manual — built-in web server — oversells it considerably, and the gap is worth knowing before it is discovered under time pressure.

$ php -S 127.0.0.1:8000 -t public/
PHP 5.4.3 Development Server started at Thu May 10 11:31:08 2012
Listening on http://127.0.0.1:8000
Document root is /home/dev/catalogue/public
Press Ctrl-C to quit.

[Thu May 10 11:31:22 2012] 127.0.0.1:52911 [200]: /index.php
[Thu May 10 11:31:22 2012] 127.0.0.1:52912 [404]: /favicon.ico - No such file

# there is no mod_rewrite, so a front controller needs a router script
$ php -S 127.0.0.1:8000 -t public/ public/router.php

It handles one request at a time, in one process, with no queue worth the name. A page that fetches its own sidebar or an internal API over HTTP will deadlock against itself and sit there until something times out, which presents as “the application hangs on this branch” and wastes an hour. Beyond that: no .htaccess, so no rewrites and no per-directory php_value; a fixed internal MIME table, so an unusual extension is served as plain text; and php_sapi_name() returns cli-server, which any code branching on the SAPI will not have heard of. The router script is the only routing available, and it needs return false for paths that exist on disk or the front controller ends up serving the stylesheets. None of this is a defect — it is a debugging tool that starts in a second — but it is the complete list of reasons never to let anything outside the machine reach it.