puiu91
5/11/2016 - 1:08 AM

Starting a local PHP cli server

Starting a local PHP cli server

<?php

if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER['REQUEST_URI'])) {
    return false;
} else {
    include __DIR__ . '/index.php';
}

use -t to target directory

  • php -S localhost:8000 -t C:\code

remove -t to target specific file

  • php -S localhost:8000 C:\code\routing.php