How to use things like Fat-Free Framework with “php -S”
Having grown very used commands like these, nobody was more eager than I when PHP 5.4 introduced its own no-setup development server.
python manage.py runserver (Django)
paster serve --reload (Pylons)
nodemon (NodeMon for Node.js)
jekyll --auto --server (Jekyll, used by GitHub Pages)
However, in typical PHP fashion, there’s some assembly required and you’ll probably need code from either the comments or somebody’s blog to get it to behave the way you’d expect it to by default.
So, without further ado, here is what I came up with to get the basic “excise index.php from the URLs and pass static files through” behaviour most people use
(There is a command-line option for this sort of behaviour, but it doesn’t match the behaviour of the net’s most ubiquitous mod_rewrite snippet.)
It’s been tested under Fat-Free Framework 2.0.6 through 2.0.12 and, if there are any incompatibilities with other frameworks or PHP applications, they should be minor.
How to use things like Fat-Free Framework with “php -S” by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
This entry was posted in Geek Stuff
. Bookmark the permalink