Trying out using PHP with thrift and I can't run it properly due to being unable to find certain classes. I was able to do this in 0.8.0 fine, now that I've downloaded 0.9.0 I'm at a loss as to how I should include the thrift files properly.
Here is my snippet of code:
$GLOBALS['THRIFT_ROOT'] = '/home/user/final/Thrift';
require_once( $GLOBALS['THRIFT_ROOT'] . '/Transport/TSocket.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/Transport/TBufferedTransport.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/Protocol/TBinaryProtocol.php' );
require_once( 'Hbase/Hbase.php');
require_once( 'Hbase/Types.php');
use Hbase\HbaseClient;
try
{
$socket = new TSocket('127.0.0.1', 9090);
$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol = new TBinaryProtocolAccelerated($transport);
$client = new HbaseClient( $protocol );
$transport->open();
//show all tables
$tables = $client->getTableNames();
foreach ( $tables as $name )
{
echo( " found: {$name}\n" );
}
}
catch (Exception $e)
{
echo "Exception: %e\r\n";
}
All files are layed out properly in the directories as seen here:
But when I run the file from the command line (php -f index.php) I'm receiving this error:
Class 'Thrift\Transport\TTransport' not found in /home/user/final/Thrift/Transport/TSocket.php on line 35
I'm really at a loss as to what I should do next, I'm not familiar with using the "use" command or "namespace" in PHP, which I have a feeling would help solve this. The thrift README for php also mentions using symfony, which is just further confusing me.
Any advice would be greatly appreciated!
Thanks!