国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

php start.php start無法啟動, 報錯Address already in use

superchangme
[root@izm5e3gye2rcpk730gsan1z GatewayWorker]# php start.php restart -d
Workerman[start.php] restart 
Workerman[start.php] is stopping ...
Workerman[start.php] stop success
[root@izm5e3gye2rcpk730gsan1z GatewayWorker]# stream_socket_server(): unable to connect to tcp://0.0.0.0:8282 (Address already in use) in file /usr/local/www/GatewayWorker/vendor/workerman/workerman/Worker.php on line 2178

Fatal error: Uncaught exception 'Exception' with message 'Address already in use' in /usr/local/www/GatewayWorker/vendor/workerman/workerman/Worker.php:2180
Stack trace:
#0 /usr/local/www/GatewayWorker/vendor/workerman/workerman/Worker.php(619): Workerman\Worker->listen()
#1 /usr/local/www/GatewayWorker/vendor/workerman/workerman/Worker.php(503): Workerman\Worker::initWorkers()
#2 /usr/local/www/GatewayWorker/start.php(37): Workerman\Worker::runAll()
#3 {main}
  thrown in /usr/local/www/GatewayWorker/vendor/workerman/workerman/Worker.php on line 2180

求救,我調整了緩沖區(qū)大小
$gateway-$sendToClientBufferSize = 10241024100;

已經嘗試過重啟nginx,重啟php-fpm都不行,在線求助。

9219 3 1
3個回答

phpcreeper

1、8282 端口被占用了,干掉占用這個端口的程序或者換一個端口試試;
2、workerman是基于PHP-CLI的,和PHP-FPM沒有任何關系;

  • superchangme 2019-11-20

    [root@izm5e3gye2rcpk730gsan1z GatewayWorker]# lsof -i :8282
    [root@izm5e3gye2rcpk730gsan1z GatewayWorker]# netstat -tunlp|grep 8282
    [root@izm5e3gye2rcpk730gsan1z GatewayWorker]#
    大哥,我找不到端口被占用。

  • superchangme 2019-11-20

    有幾個kworker的進程不知道是什么

  • phpcreeper 2019-11-20

    沒上下文就把啟動腳本代碼完整貼下

  • superchangme 2019-11-20

    blog大哥 你看我最新截圖那里我換了端口8283可以了但是8282還是在進程里殘留著

  • superchangme 2019-11-20

    我是中途把127.0.0.1的ip直接改成了0.0.0.0 然后又restart了是不是這樣會導致進程殘留呢

superchangme
<?php 
/**
 * This file is part of workerman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link http://wtbis.cn/
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 */
use \Workerman\Worker;
use \Workerman\WebServer;
use \GatewayWorker\Gateway;
use \GatewayWorker\BusinessWorker;
use \Workerman\Autoloader;
use \Workerman\Protocols\Websocket;
use \GatewayWorker\Lib\Gateway\Events;
use \GlobalData\Client;

// 自動加載類
require_once __DIR__ . '/../../vendor/autoload.php';

$GlobalClient = new Client('0.0.0.0:2207');

// gateway 進程,這里使用Text協(xié)議,可以用telnet測試
$gateway = new Gateway("Websocket://0.0.0.0:8282");
// gateway名稱,status方便查看
$gateway->name = 'YourAppGateway';
// gateway進程數(shù)
$gateway->count = 4;
// 本機ip,分布式部署時使用內網ip
$gateway->lanIp = '127.0.0.1';
// 內部通訊起始端口,假如$gateway->count=4,起始端口為4000
// 則一般會使用4000 4001 4002 4003 4個端口作為內部通訊端口 
$gateway->startPort = 2900;
// 服務注冊地址
$gateway->registerAddress = '127.0.0.1:1238';

// 心跳間隔
$gateway->pingInterval = 55;
// 心跳數(shù)據(jù)
// $gateway->pingData = '{"type":"ping"}';

$gateway->pingNotResponseLimit = 1;

$gateway->pingData = '';
// 采用二進制傳輸數(shù)據(jù)
$gateway->onConnect = function($connection)
{
  $connection->websocketType = Websocket::BINARY_TYPE_ARRAYBUFFER;
}; 

$gateway->onBufferFull = function($connection)
{
    // string(111) "a:3:{s:9:"client_id";s:20:"7f0000010b5400000004";s:7:"room_id";s:7:"ROOMONE";s:11:"client_name";s:7:"xiaohei";}"
    global $GlobalClient;
    $session = unserialize($connection->session);
    $client_id = $session['client_id'];
    echo 'client_id---'.$client_id .' is buffer full';
    $GlobalClient->add($client_id .'_cache',1);
    $bufferCache = $GlobalClient->__get($client_id.'_cache_data');
    if(empty($bufferCache)){
        $GlobalClient->add($client_id .'_cache_data',array());
    }
};
$gateway->onBufferDrain = function($connection)
{
    // echo "buffer drain and continue send\n".$_SESSION['isBufferFull'];
    // if(isset($_SESSION['bufferCache'])){
    //   print_r($_SESSION['bufferCache']);
    //   echo 'handler buffercache----cache len--'.count($_SESSION['bufferCache']);
    //   foreach ($cache as $_SESSION['bufferCache']) {
    //     //Events::onMessage($cache['client_id'],$cache['message']);
    //     $connection->send($cache['data']);
    //     // 等同于Event.php onMessage的 Gateway::sendToClient($json_info['to_client_id'], $message);
    //   }
    //   unset($_SESSION['isBufferFull']);
    //   unset($_SESSION['bufferCache']);
    // }
    global $GlobalClient;
    $session = unserialize($connection->session);
    $client_id = $session['client_id'];
    // echo 'client_id---'.$client_id .' is buffer full'.$GlobalClient->{$client_id.'_cache'};
    $GlobalClient->__unset($client_id.'_cache');
    echo 'in buffer drain can send again---\n';
    $bufferCache = $GlobalClient->__get($client_id.'_cache_data');
    echo 'buffer count---'.count($bufferCache);

    if(count($bufferCache)==0){
        $GlobalClient->__unset($client_id.'_cache_data');
        return;
    }
    foreach ($bufferCache as $i=>$cache) {
        //Events::onMessage($cache['client_id'],$cache['message']);
        if(empty($GlobalClient->__get($client_id .'_cache'))){
            echo 'send --- '.$i;
            $connection->send($cache);
            unset($bufferCache[$i]);
        }
        // 等同于Event.php onMessage的 Gateway::sendToClient($json_info['to_client_id'], $message);
    }
    $GlobalClient->__set($client_id.'_cache_data',$bufferCache);
        // 
};
$gateway->onError = function($connection, $code, $msg)
{
    echo "error $code $msg\n";
};
/* 
// 當客戶端連接上來時,設置連接的onWebSocketConnect,即在websocket握手時的回調
$gateway->onConnect = function($connection)
{
    $connection->onWebSocketConnect = function($connection , $http_header)
    {
        // 可以在這里判斷連接來源是否合法,不合法就關掉連接
        // $_SERVER['HTTP_ORIGIN']標識來自哪個站點的頁面發(fā)起的websocket鏈接
        if($_SERVER['HTTP_ORIGIN'] != 'http://kedou.workerman.net')
        {
            $connection->close();
        }
        // onWebSocketConnect 里面$_GET $_SERVER是可用的
        // var_dump($_GET, $_SERVER);
    };
}; 
*/

// 如果不是在根目錄啟動,則運行runAll方法
if(!defined('GLOBAL_START'))
{
    Worker::runAll();
}
  • 暫無評論
xiuwang

你啟動了2個相同端口的gateway進程,所以端口沖突了。
你看下是不是有多個 start_gateway_xxx.php 文件。只保留一個,不然會一起啟動。

  • superchangme 2019-11-20

    是只有一個start_gateway文件,但是我中間改了ip 從127.0.0.1改成了0.0.0.0 重啟之后就不行了

  • superchangme 2019-11-20

    [root@izm5e3gye2rcpk730gsan1z GatewayWorker]# find / -name 'start_gateway*.php'
    /usr/local/www/GatewayWorker/Applications/chat/start_gateway.php
    /usr/local/www/GatewayWorker/Applications/YourApp/start_gateway.php

  • superchangme 2019-11-20

    謝謝大哥確實有兩個了。。。

年代過于久遠,無法發(fā)表回答
??