protected function createServerProcess($address, $docRoot, $projectRoot, array $appConfig, array $env = [])
    {
        if (isset($appConfig['type'])) {
            $type = explode(':', $appConfig['type'], 2);
            $version = isset($type[1]) ? $type[1] : false;
            if ($type[0] === 'php' && $version && version_compare(PHP_VERSION, $version, '<')) {
                $this->stdErr->writeln(sprintf(
                    '<comment>Warning:</comment> your local PHP version is %s, but the app expects %s',
                    PHP_VERSION,
                    $version
                ));
            }
        }

        $arguments = [];

        if (isset($appConfig['web']['commands']['start'])) {
            // Bail out. We can't support custom 'start' commands for now.
            throw new \Exception(
                "Not supported: the CLI doesn't support starting a server with a custom 'start' command"
            );
        }

        $router = $this->createRouter($projectRoot);

        $this->showSecurityWarning();

        $arguments[] = (new PhpExecutableFinder())->find() ?: PHP_BINARY;

        foreach ($this->getServerPhpConfig() as $item => $value) {
            $arguments[] = sprintf('-d %s="%s"', $item, $value);
        }

        $arguments = array_merge($arguments, [
          '-t',
          $docRoot,
          '-S',
          $address,
          $router,
        ]);

        $process = new Process($arguments);
        $process->setTimeout(null);
        $env += $this->createEnv($projectRoot, $docRoot, $address, $appConfig);
        $process->setEnv($env);
        $envPrefix = $this->config()->get('service.env_prefix');
        if (isset($env[$envPrefix . 'APP_DIR'])) {
            $process->setWorkingDirectory($env[$envPrefix . 'APP_DIR']);
        }

        return $process;
    }
protected function createServerProcess($address, $docRoot, $projectRoot, array $appConfig, array $env = [])
    {
        if (isset($appConfig['type'])) {
            $type = explode(':', $appConfig['type'], 2);
            $version = isset($type[1]) ? $type[1] : false;
            if ($type[0] === 'php' && $version && version_compare(PHP_VERSION, $version, '<')) {
                $this->stdErr->writeln(sprintf(
                    '<comment>Warning:</comment> your local PHP version is %s, but the app expects %s',
                    PHP_VERSION,
                    $version
                ));
            }
        }

        $arguments = [];

        if (isset($appConfig['web']['commands']['start'])) {
            // Bail out. We can't support custom 'start' commands for now.
            throw new \Exception(
                "Not supported: the CLI doesn't support starting a server with a custom 'start' command"
            );
        }

        $router = $this->createRouter($projectRoot);

        $this->showSecurityWarning();

        $arguments[] = (new PhpExecutableFinder())->find() ?: PHP_BINARY;

        foreach ($this->getServerPhpConfig() as $item => $value) {
            $arguments[] = sprintf('-d %s="%s"', $item, $value);
        }

        $arguments = array_merge($arguments, [
          '-t',
          $docRoot,
          '-S',
          $address,
          $router,
        ]);

        $process = new Process($arguments);
        $process->setTimeout(null);
        $env += $this->createEnv($projectRoot, $docRoot, $address, $appConfig);
        $process->setEnv($env);
        $envPrefix = $this->config()->get('service.env_prefix');
        if (isset($env[$envPrefix . 'APP_DIR'])) {
            $process->setWorkingDirectory($env[$envPrefix . 'APP_DIR']);
        }

        return $process;
    }
protected function createServerProcess ( $ address , $ docRoot , $ projectRoot , array $ appConfig , array $ env = [ ] ) { if ( isset ( $ appConfig [ 'type' ] ) ) { $ type = explode ( ':' , $ appConfig [ 'type' ] , 2 ) ; $ version = isset ( $ type [ 1 ] ) ? $ type [ 1 ] : false ; if ( $ type [ 0 ] === 'php' && $ version && version_compare ( PHP_VERSION , $ version , '<' ) ) { $ this -> stdErr -> writeln ( sprintf ( '<comment>Warning:</comment> your local PHP version is %s, but the app expects %s' , PHP_VERSION , $ version ) ) ; } } $ arguments = [ ] ; if ( isset ( $ appConfig [ 'web' ] [ 'commands' ] [ 'start' ] ) ) { // Bail out. We can't support custom 'start' commands for now. throw new \ Exception ( "Not supported: the CLI doesn't support starting a server with a custom 'start' command" ) ; } $ router = $ this -> createRouter ( $ projectRoot ) ; $ this -> showSecurityWarning ( ) ; $ arguments [ ] = ( new PhpExecutableFinder ( ) ) -> find ( ) ? : PHP_BINARY ; foreach ( $ this -> getServerPhpConfig ( ) as $ item => $ value ) { $ arguments [ ] = sprintf ( '-d %s="%s"' , $ item , $ value ) ; } $ arguments = array_merge ( $ arguments , [ '-t' , $ docRoot , '-S' , $ address , $ router , ] ) ; $ process = new Process ( $ arguments ) ; $ process -> setTimeout ( null ) ; $ env += $ this -> createEnv ( $ projectRoot , $ docRoot , $ address , $ appConfig ) ; $ process -> setEnv ( $ env ) ; $ envPrefix = $ this -> config ( ) -> get ( 'service.env_prefix' ) ; if ( isset ( $ env [ $ envPrefix . 'APP_DIR' ] ) ) { $ process -> setWorkingDirectory ( $ env [ $ envPrefix . 'APP_DIR' ] ) ; } return $ process ; }
Creates a process to start a web server.

@param string $address
@param string $docRoot
@param string $projectRoot
@param array $appConfig
@param array $env

@throws \Exception

@return Process
Creates a process to start a web server .