Running Magento in PHP 5.4's built-in web server

Whilst this isn't a good idea for a production store, if you want to just experiment or develop locally, this works just fine.

Instructions for Debian

cat >> /etc/apt/sources.lst <<EOF
deb https://packages.dotdeb.org squeeze-php54 all
deb-src https://packages.dotdeb.org squeeze-php54 all
EOF

wget -qO - https://www.dotdeb.org/dotdeb.gpg | apt-key add -
apt-get update
apt-get install php5-cli php5-mysqlnd php5-mcrypt php5-common php-pear php5-dev php5-mysql php5-curl php5-mcrypt php5-gd php5-cli php5-xsl php5-imagick

Then make a simple router, that mimicked the rules in a stock Magento .htaccess.

Put this in router.php in your Magento base directory.

<?php

  if (preg_match('#^/api/rest#', $_SERVER["REQUEST_URI"])) {
      $_SERVER["REQUEST_URI"] = 'api.php?type=rest';
  } elseif (preg_match('#^/(media|skin|js)#', $_SERVER["REQUEST_URI"])) {
      return false;
  } elseif (file_exists(".".$_SERVER["REQUEST_URI"]))  {
      return false;
  } else {
      include_once 'index.php';
  }

?>

Then start the PHP server and point it at router.php (the file from above).

php -S 127.0.0.1:80 router.php

That's it - now just point your web browser at your new PHP web server.