URL rewriting in built-in web server of PHP

PHP comes with a handy for development built-in web server.  However, most web projects have friendly URLs these days which are either Apache (mod_rewrite) or Nginx specific configuration.  This almost renders built-in PHP web server useless.  Unless you provide a PHP-based routing, like so:

$request_uri = __DIR__ . $_SERVER["REQUEST_URI"];
if (file_exists($request_uri)) {
  return false;
} else {
  include __DIR__ . ‘/index.php';
}

Start the PHP web server with the following command then (routing.php being a file with the above content):

$ cd my-project && php -S localhost:8000 routing.php

Thanks to this blog post and comments.  Now you can completely skip having Apache and Nginx on developer machines and all that shenanigan with configuring virtual hosts, modules, and such.

The Secrets of the FBI by Ronald Kessler

secrets_of_the_fbi

The Secrets of the FBI” is the second audio book by Ronald Kessler that I’ve listened to.  I enjoyed it much more than “In the President’s Secret Service“.  This one covers the history of the FBI in much more detail, and provides both insider’s perspective and a bird’s eye view of how the FBI was created, evolved and got the where it is now.

One thing that I found very interesting was how much an impact each of the directors had on the development of the FBI, and how different these were.   Also, descriptions of technology evolution in the FBI were particularly interesting to me.  The state of the computeres by the 9/11 was especially depressing.  I nearly couldn’t believe what I was hearing…

Overall, I’d recommend this book to anyone interested in law enforcement history, government projects, and special tactical units.

In the President’s Secret Service by Ronald Kessler

In-the-presidents-secret-service

Now that I drive plenty on a daily basis, I have a lot of time to listen to audio books.  I don’t have the routine or taste worked out yet, so my picks are rather random.  One of the first things that got onto my radar was “Inside the President’s Secret Service” by Ronald Kessler.

I do have a fascination with all kinds of special forces and units, so that was a quick pick.  Unfortunately, the book doesn’t go into too much detail of the Secret Service training (maybe because it is a Secret Service), but it does cover a bit of history and provides a bit of insight into what kind of a job a Secret Service agent has.  The rest of the book is dedicated to the different presidents and their families – how are they in real life, when the cameras aren’t rolling.  I don’t know how much of these are actually true, but it was still interesting to listen to and “compare notes”.  There were also some funny anecdotes in there.

As far as recommendations go, I wouldn’t suggest this book, unless you are completely out of ideas for anything else.  There are better ones.