liunx下 tp6自定义workerman指令;

浏览:548 发布日期:2022/09/29
5.0.0 - 普通 - 未处理
liunx下无法后台运行,进程不存在

使用workerman自定义指令启动的
think Startws1 start 正常启动
think Startws1 start --mode d 异常


https://www.kancloud.cn/manual/thinkphp6_0/1147857 
    public function execute(Input $input, Output $output)
    {
      $action= $input->getArgument('action');
      $mode = $input->getOption('mode');
    // 重新构造命令行参数,以便兼容workerman的命令
    global $argv;

    $argv = [];

    array_unshift($argv, 'think', $action);
    if ($mode == 'd') {
      $argv[] = '-d';
    } else if ($mode == 'g') {
      $argv[] = '-g';
    }
    
  if ('start' == $action) {
    $output->writeln('Starting Workerman server...');
    $this->start(1, 0);
} }
   /**
 * 启动
 * @access public
 * @return void
 */
public function start()
{
    $worker = new Worker();Worker::$daemonize = true;
    $worker->onWorkerStart = function()
    {
    $con_url="xxxx";
    $con = new AsyncTcpConnection($con_url);$con->transport = 'ssl';
    //逻辑代码省略
    }
    Worker::runAll();
    }
*win正常启动,放到liunx好像就不能,执行命令

*win进程正常执行,
*Linux就think进程存在,指令进程不存在
*是不是不支持AsyncTcpConnection;还是说要装拓展
评论(
后面还有条评论,点击查看>>