使用thrift rpc框架,在Handler文件中连接mysql就报错

throo8

我使用workerman Thrift Rpc框架,在Handler文件中实现接口方法的时候,想连mysql查询一下数据的时候报下面错,如果不连接mysql就没有问题,不知道为什么

PHP Fatal error:  Uncaught exception 'Thrift\Exception\TTransportException' with message 'TSocket read 0 bytes' in \workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Transport\TSocket.php:269
Stack trace:
#0 \workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Transport\TTransport.php(74): Thrift\Transport\TSocket->read(4)
#1 \rpcdemo\workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Transport\TBufferedTransport.php(113): Thrift\Transport\TTransport->readAll(4)
#2 \workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Protocol\TBinaryProtocol.php(306): Thrift\Transport\TBufferedTransport->readAll(4)
#3 \workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Protocol\TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#4 \workerman-thrift-master\Applications\ThriftRpc\Services\Account\Account.php(92): Thrift\Protocol\TBinaryProtocol->readMessage in D:\AcmCoder\user\rpcdemo\workerman-thrift-master\Applications\ThriftRpc\Lib\Thrift\Transport\TSocket.php on line 269

代码就是很简单的一句连一下mysql
$mysqli = new mysqli($dbhost,$dbuser,$dbpass,$dbname);

阅读 4637
1个回答

walkor

数据库太慢,超时了

  • throo8 2016-03-03

    请问这个超时时间能设长点儿吗?是修改TSocket.php文件中的那几个参数就可以了吗?