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

仇龙光
2023-12-01

我使用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);

 类似资料: