2

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.

moeseth
  • 1,855
  • 5
  • 23
  • 47
  • did you have any luck with this? I'm having a similar issue – melis Dec 12 '16 at 16:45
  • @melis, try `use \hello\HelloPrintIf` – moeseth Dec 13 '16 at 07:44
  • I found out, I changed the service name in the thrift file, and kept calling the old name from the php server stub and of course that caused the issue in my case. Thanks for pointing out to the correct place. – melis Dec 13 '16 at 17:22

0 Answers0