Workerman\WebServer::onWorkerStart PHP Method

onWorkerStart() public method

Emit when process start.
public onWorkerStart ( )
    public function onWorkerStart()
    {
        if (empty($this->serverRoot)) {
            echo new \Exception('server root not set, please use WebServer::addRoot($domain, $root_path) to set server root path');
            exit(250);
        }
        // Init mimeMap.
        $this->initMimeTypeMap();
        // Try to emit onWorkerStart callback.
        if ($this->_onWorkerStart) {
            try {
                call_user_func($this->_onWorkerStart, $this);
            } catch (\Exception $e) {
                self::log($e);
                exit(250);
            } catch (\Error $e) {
                self::log($e);
                exit(250);
            }
        }
    }