You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Dave Jones <Da...@spilgames.com> on 2010/06/22 13:22:25 UTC

How to use the thrift native PHP extension?

Hi,

We've installed Cassandra 0.6.2 and Thrift 0.2.0, and have generated the PHP Cassandra bindings using
thrift -gen php cassandra.thrift

After this, we followed these steps to build the native php extension:

phpize
./configure --enable-thrift_protocol
make

sudo cp modules/thrift_protocol.so /usr/lib/php/modules/

Created /etc/php.d/thrift_protocol.ini, with contents:
extension=thrift_protocol.so

So far, so good.

However, we're not sure how to actually use the native extension.  Nothing found in the source of Casssndra.php.

Any ideas?    Does anyone know where we can find documentation about using the php extension?

Thanks, Dave

RE: How to use the thrift native PHP extension?

Posted by Dave Jones <Da...@spilgames.com>.
Thank you for the quick reply, problem resolved, your answer was much appreciated!

-----Original Message-----
From: yaw [mailto:yawyway@gmail.com] 
Sent: dinsdag 22 juni 2010 14:14
To: thrift-user@incubator.apache.org
Subject: Re: How to use the thrift native PHP extension?

Hello,
I've followed this how-to :
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP


To use native thrift protocol, you will have to call
TBinaryProtocolAccelerated class
instead of TBinaryProtocol.


*8. "Ensure that the PHP is using TBinaryProtocolAccelerated and not
TBinaryProtocol as the protocol."

*

*$cassandraSocket = new TSocket($cassandraHost, $cassandraPort);*

*$cassandraTransport = new TBufferedTransport($cassandraSocket, 1024, 1024);
*

*$cassandraProtocol = new TBinaryProtocolAccelerated($cassandraTransport);*
*...*




2010/6/22 Dave Jones <Da...@spilgames.com>

> Hi,
>
> We've installed Cassandra 0.6.2 and Thrift 0.2.0, and have generated the
> PHP Cassandra bindings using
> thrift -gen php cassandra.thrift
>
> After this, we followed these steps to build the native php extension:
>
> phpize
> ./configure --enable-thrift_protocol
> make
>
> sudo cp modules/thrift_protocol.so /usr/lib/php/modules/
>
> Created /etc/php.d/thrift_protocol.ini, with contents:
> extension=thrift_protocol.so
>
> So far, so good.
>
> However, we're not sure how to actually use the native extension.  Nothing
> found in the source of Casssndra.php.
>
> Any ideas?    Does anyone know where we can find documentation about using
> the php extension?
>
> Thanks, Dave
>

Re: How to use the thrift native PHP extension?

Posted by yaw <ya...@gmail.com>.
Hello,
I've followed this how-to :
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP


To use native thrift protocol, you will have to call
TBinaryProtocolAccelerated class
instead of TBinaryProtocol.


*8. "Ensure that the PHP is using TBinaryProtocolAccelerated and not
TBinaryProtocol as the protocol."

*

*$cassandraSocket = new TSocket($cassandraHost, $cassandraPort);*

*$cassandraTransport = new TBufferedTransport($cassandraSocket, 1024, 1024);
*

*$cassandraProtocol = new TBinaryProtocolAccelerated($cassandraTransport);*
*...*




2010/6/22 Dave Jones <Da...@spilgames.com>

> Hi,
>
> We've installed Cassandra 0.6.2 and Thrift 0.2.0, and have generated the
> PHP Cassandra bindings using
> thrift -gen php cassandra.thrift
>
> After this, we followed these steps to build the native php extension:
>
> phpize
> ./configure --enable-thrift_protocol
> make
>
> sudo cp modules/thrift_protocol.so /usr/lib/php/modules/
>
> Created /etc/php.d/thrift_protocol.ini, with contents:
> extension=thrift_protocol.so
>
> So far, so good.
>
> However, we're not sure how to actually use the native extension.  Nothing
> found in the source of Casssndra.php.
>
> Any ideas?    Does anyone know where we can find documentation about using
> the php extension?
>
> Thanks, Dave
>