Require PHP 5.4

Also fix placement of variables in api.php