示例#1
0
 function __construct($config = array())
 {
     define('SWOOLE_SERVER', true);
     $mimes = (require LIBPATH . '/data/mimes.php');
     $this->mime_types = array_flip($mimes);
     $this->config = $config;
     Swoole\Error::$echo_html = true;
     $this->parser = new Swoole\Http\Parser();
 }
示例#2
0
 function onStart($serv, $worker_id = 0)
 {
     if (!defined('WEBROOT')) {
         define('WEBROOT', $this->config['server']['webroot']);
     }
     if (isset($this->config['server']['user'])) {
         Swoole\Console::changeUser($this->config['server']['user']);
     }
     Swoole\Error::$echo_html = true;
     $this->swoole_server = $serv;
     Swoole::$php->server = $this;
     $this->log(self::SOFTWARE . "[#{$worker_id}]. running. on {$this->server->host}:{$this->server->port}");
     register_shutdown_function(array($this, 'onError'));
 }
 function onStart($serv, $worker_id = 0)
 {
     global $yaf;
     if (!defined('WEBROOT')) {
         define('WEBROOT', $this->config['server']['webroot']);
     }
     if (isset($this->config['server']['user'])) {
         Swoole\Console::changeUser($this->config['server']['user']);
     }
     $this->application = new \Yaf_Application(WEBPATH . "/conf/application.ini");
     $yaf->application = $this->application;
     Swoole\Error::$echo_html = true;
     $this->swoole_server = $serv;
     //Swoole::$php->server = $this;
     $this->log(self::SOFTWARE . "[#{$worker_id}]. running. on {$this->server->host}:{$this->server->port}");
     set_error_handler(array($this, 'onErrorHandle'), E_USER_ERROR);
     register_shutdown_function(array($this, 'onErrorShutDown'));
 }
 function onStart($serv, $worker_id = 0)
 {
     if (!defined('WEBROOT')) {
         define('WEBROOT', $this->config['server']['webroot']);
     }
     if (isset($this->config['server']['user'])) {
         Swoole\Console::changeUser($this->config['server']['user']);
     }
     if ($this->server instanceof Swoole\Network\Server and isset($this->config['server']['process_rename'])) {
         global $argv;
         if ($worker_id >= $serv->setting['worker_num']) {
             Swoole\Console::setProcessName('php ' . $argv[0] . ': task');
         } else {
             Swoole\Console::setProcessName('php ' . $argv[0] . ': worker');
         }
     }
     Swoole\Error::$echo_html = true;
     $this->swoole_server = $serv;
     Swoole::$php->server = $this;
     $this->log(self::SOFTWARE . "[#{$worker_id}]. running. on {$this->server->host}:{$this->server->port}");
     register_shutdown_function(array($this, 'onError'));
 }
示例#5
0
 function __construct($config = array())
 {
     define('SWOOLE_SERVER', true);
     Swoole\Error::$echo_html = true;
 }
示例#6
0
 function run($array)
 {
     \Swoole\Error::$echo_html = true;
     $this->server->run($array);
 }