protected function  start(
        $interface    = self::INTERFACE_LOCALHOST,
        $port         = self::DEFAULT_PORT,
        $documentRoot = self::DEFAULT_DOCUMENT_ROOT,
        $router       = self::DEFAULT_ROOTER
    ) {
        // The command to execute
        $command = sprintf('php -S %s:%s -t %s%s 2>&1', $interface, $port, $documentRoot, $router);

        // The descriptor specs / pipe definition
        $descriptorspec = array(
            0 => array('pipe', 'r'),         // STDIN  => Pipe
            1 => array('pipe', 'w'),         // STDOUT => Pipe
            2 => array('pipe', 'w', 'a'),    // STDERR => Pipe
        );

        // Start our built-in web server
        $this->server = proc_open(
            $command,
            $descriptorspec,
            $this->pipes,
            $documentRoot
        );

        // Check for running server ...
        if ($this->isRunning($this->server) === false) {
            $this->showError('Failed to start test web server!');

        } else {
            $status = proc_get_status($this->server);
            echo $this->colorize('Server running ', '%g').
                 sprintf('[PID: %s] ', $status['pid']).
                 $this->colorize(
                    sprintf(
                        '%s:%s %s %s',
                        $interface,
                        $port,
                        $documentRoot,
                        $router
                    ).' ',
                    '%y'
                 ).PHP_EOL;
            echo 'Press Ctrl + C to stop ...'.PHP_EOL;
            #file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'doozr-webserver.pid', $status['pid']);

            // Check if running in a loop
            while ($this->isRunning($this->server) !== false) {
                echo $this->fetchStreams($this->pipes);
            }
        }
    }
protected function  start(
        $interface    = self::INTERFACE_LOCALHOST,
        $port         = self::DEFAULT_PORT,
        $documentRoot = self::DEFAULT_DOCUMENT_ROOT,
        $router       = self::DEFAULT_ROOTER
    ) {
        // The command to execute
        $command = sprintf('php -S %s:%s -t %s%s 2>&1', $interface, $port, $documentRoot, $router);

        // The descriptor specs / pipe definition
        $descriptorspec = array(
            0 => array('pipe', 'r'),         // STDIN  => Pipe
            1 => array('pipe', 'w'),         // STDOUT => Pipe
            2 => array('pipe', 'w', 'a'),    // STDERR => Pipe
        );

        // Start our built-in web server
        $this->server = proc_open(
            $command,
            $descriptorspec,
            $this->pipes,
            $documentRoot
        );

        // Check for running server ...
        if ($this->isRunning($this->server) === false) {
            $this->showError('Failed to start test web server!');

        } else {
            $status = proc_get_status($this->server);
            echo $this->colorize('Server running ', '%g').
                 sprintf('[PID: %s] ', $status['pid']).
                 $this->colorize(
                    sprintf(
                        '%s:%s %s %s',
                        $interface,
                        $port,
                        $documentRoot,
                        $router
                    ).' ',
                    '%y'
                 ).PHP_EOL;
            echo 'Press Ctrl + C to stop ...'.PHP_EOL;
            #file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'doozr-webserver.pid', $status['pid']);

            // Check if running in a loop
            while ($this->isRunning($this->server) !== false) {
                echo $this->fetchStreams($this->pipes);
            }
        }
    }
protected function start ( $ interface = self :: INTERFACE_LOCALHOST , $ port = self :: DEFAULT_PORT , $ documentRoot = self :: DEFAULT_DOCUMENT_ROOT , $ router = self :: DEFAULT_ROOTER ) { // The command to execute $ command = sprintf ( 'php -S %s:%s -t %s%s 2>&1' , $ interface , $ port , $ documentRoot , $ router ) ; // The descriptor specs / pipe definition $ descriptorspec = array ( 0 => array ( 'pipe' , 'r' ) , // STDIN  => Pipe 1 => array ( 'pipe' , 'w' ) , // STDOUT => Pipe 2 => array ( 'pipe' , 'w' , 'a' ) , // STDERR => Pipe ) ; // Start our built-in web server $ this -> server = proc_open ( $ command , $ descriptorspec , $ this -> pipes , $ documentRoot ) ; // Check for running server ... if ( $ this -> isRunning ( $ this -> server ) === false ) { $ this -> showError ( 'Failed to start test web server!' ) ; } else { $ status = proc_get_status ( $ this -> server ) ; echo $ this -> colorize ( 'Server running ' , '%g' ) . sprintf ( '[PID: %s] ' , $ status [ 'pid' ] ) . $ this -> colorize ( sprintf ( '%s:%s %s %s' , $ interface , $ port , $ documentRoot , $ router ) . ' ' , '%y' ) . PHP_EOL ; echo 'Press Ctrl + C to stop ...' . PHP_EOL ; #file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'doozr-webserver.pid', $status['pid']); // Check if running in a loop while ( $ this -> isRunning ( $ this -> server ) !== false ) { echo $ this -> fetchStreams ( $ this -> pipes ) ; } } }
Starts PHP's internal webserver and give us some control of it.

@param string $interface    The interface to listen on (e.g. 0.0.0.0 or 127.0.0.1 or localhost ...)
@param integer $port         The port to listen on (e.g. HTTP default 80)
@param string $documentRoot The document root to serve from
@param string $router       The router script (replacement for mod_rewrite)

@author Benjamin Carl <opensource@clickalicious.de>
@return mixed A result in any form.
@access protected
Starts PHP s internal webserver and give us some control of it .