赞
踩
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
1、Down the Thrift code.
http://incubator.apache.org/thrift/download/
2、Building the PHP client
2.1 Configure and build Thrift.
./configure make
2.2 Build the PHP Thrift interface for Cassandra:
./compiler/cpp/thrift -gen php ../PATH-TO-CASSANDRA/interface/cassandra.thrift
2.3 Copy the include files to a useful place (per the Cassandra “Getting Started” guide):
mkdir -p /usr/share/php/Thrift cp -R gen-php/ /usr/share/php/Thrift/packages/ cp -R lib/php/src/* /usr/share/php/Thrift/
3、Building and installing the native PHP extension
Installing and using the native PHP extension provides approximately a ten-fold performance boost on writing data.
3.1 Change to PATH-TO-THRIFT/lib/php/src/ext/thrift_protocol.
3.2 Install support for building PHP extensions:
/usr/local/webserver/php/bin/phpize ./configure --enable-thrift_protocol --with-php-config=/usr/local/webserver/php/bin/php-config make
3.3 Copy the extension’s .so to the extensions directory.
cp modules/thrift_protocol.so /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/
3.4 Enable the module.
edit php.ini and add: extension=thrift_protocol.so
3.5 Then restart php-fpm
4、Checking the connection
4.1 Copy in the PHP from the Cassandra client examples page to /var/www/cassandra-test.php.
4.2 Visit http://localhost/cassandra-test.php in the browser.
4.3 On the first load, the array output should be empty. On the second, there should be content.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。