Apache Thrift not loading PHP definition

你说的曾经没有我的故事 提交于 2020-01-05 04:12:05

问题


I have the following codes. I have checked the files and they exist.

require_once "/usr/lib/php/Thrift/ClassLoader/ThriftClassLoader.php";

use Thrift\ClassLoader\ThriftClassLoader;

$GEN_PHP = __DIR__ . "/gen-php/";

$loader = new ThriftClassLoader();
$loader->registerNamespace("Thrift", "/usr/lib/php/");
$loader->registerDefinition("hello", $GEN_PHP);
$loader->register();

use Thrift\Protocol\TBinaryProtocol;
use Thrift\Transport\TPhpStream;
use Thrift\Transport\TBufferedTransport;

class HelloWorldHandler implements \hello\HelloPrinterIf {

...

};

However, I'm getting the following error when I ran.

PHP Fatal error:  Interface 'hello\HelloPrinterIf' not found in /home/admin/Desktop/thrift-test/php-server.php

I think it has something to do with ThriftClassLoader not loading hello definition.

Please let me know what I did wrong.

Thanks.

来源:https://stackoverflow.com/questions/37383646/apache-thrift-not-loading-php-definition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!