workman基配置

作者: APHOME_明 | 来源:发表于2018-04-11 13:39 被阅读0次

    1、配置config.php,所在目录:/Applications/JsonRpc

    <?php
    global $config;
    $config['record_acc_log'] = true;
    
    $config['service_socket'] = 'JsonNL://0.0.0.0:2015';
    $config['process_count'] = 1;
    $config['service_name'] = 'zgt_erp';
    $config['log_path'] = __DIR__ . '/workerman.log';
    $config['service_namespace'] = "JsonRpc\\Services\\";
    
    $config['db'] = [
        'driver' => 'mysql',
    //    'host' => '192.168.40.14',
        'host' => '127.0.0.1',
    //    'host' => '125.94.36.124',
        'database' => 'zgt_erp',
    //    'username' => 'zgt',
        'username' => 'root',
    //    'password' => 'welcome',
        'password' => 'root',
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
    ];
    $config['redis'] = [
        'scheme' => 'tcp',
        'host' => '127.0.0.1',
        'port' => '6379',
        'read_write_timeout' =>0,
        'database' => 15,
    ];
    
    $config['statistic_address'] = 'udp://127.0.0.1:55656';
    $config['task_address'] = 'udp://127.0.0.1:903';
    $config['socket_address'] = 'udp://127.0.0.1:20001';
    
    $config['contract'] = [
        'app_id' => '201712010001',
        'app_secert' => '73161ab1127d4a4fbb65babda52a5ad6',
        'url' => 'https://www.cunnar.com:15443'
    ];
    

    2、在php.ini中开启stream_socket_server函数

    3、解决报错问题:exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused'

    解决方式:原因:是因为没有配置数据库链接地址,导致连接错误,可以在/Applications/Msg/message.php文件配置$db;
    $db = new Workerman\MySQL\Connection('192.168.0.250','3306','root','123456','zgt_erp');
    

    4.配置config.php文件中的数据库地址

    相关文章

      网友评论

        本文标题:workman基配置

        本文链接:https://www.haomeiwen.com/subject/owwahftx.html