Articles with the tag Server

Routing with PHP's built in server

PHP has a built in development server, which is very handy during development. However, I had some difficulties to get it working correctly. After a lot of debugging, and reading bug reports and the php documentation I learned some things:

  • It can serve static files
  • It has some uncommon rules how to set some $_SERVER variables when the url path contains a dot. (The reason for this is probably that a dot in the url path indicates that the resource is a file rather than a dynamically generated document). And this is not documented very clearly!

If you're setup is not working but you don't have time to read the article, try my gist for a quick example.