problem with php connection

400 views
Skip to first unread message

Ярослав Харченко

unread,
Mar 14, 2017, 6:08:38 PM3/14/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi, I have installed cassandra on my server Debian GNU/Linux 8.7 (jessie)
I have installed php7.1 and me need been installed php-driver(for cassandra) nextly commands:

git clone https://github.com/datastax/php-driver.git /usr/src/datastax-php-driver
cd /usr/src/datastax-php-driver
git submodule update --init
cd ext
./install.sh

vim /etc/php/7.1/mods-available/cassandra.ini
extension=cassandra.so

phpenmod cassandra

php -i | grep cassandra
/etc/php/7.1/cli/conf.d/20-cassandra.ini,
cassandra
cassandra.log => cassandra.log => cassandra.log
cassandra.log_level => ERROR => ERROR


Well, that's ok, but

When, I have tried running test connect(php) to cassandra, I had error.

php cass.php

PHP Fatal error: Uncaught Cassandra\Exception\LogicException: Not implemented in /root/cass.php:3
Stack trace:
#0 /root/cass.php(3): Cassandra\Cluster\Builder->build()
#1 {main}
thrown in /root/cass.php on line 3


cat cass.php
<?php
$cluster = Cassandra::cluster() // connects to localhost by default
->build();
$keyspace = 'system';
$session = $cluster->connect($keyspace); // create session, optionally scoped to a keyspace
$statement = new Cassandra\SimpleStatement( // also supports prepared and batch statements
'SELECT keyspace_name, columnfamily_name FROM schema_columnfamilies'
);
$future = $session->executeAsync($statement); // fully asynchronous and easy parallel execution
$result = $future->get(); // wait for the result, with an optional timeout

foreach ($result as $row) { // results and rows implement Iterator, Countable and ArrayAccess
printf("The keyspace %s has a table called %s\n", $row['keyspace_name'], $row['columnfamily_name']);
}

?>


Please help me! Thanks.

Michael Penick

unread,
Mar 15, 2017, 12:04:11 PM3/15/17
to php-dri...@lists.datastax.com
We don't currently support PHP 7.1. That said, I'm not sure if that's the issue you're running into, but it is likely.

I surprised the driver compiled against PHP 7.1.

Mike


--
You received this message because you are subscribed to the Google Groups "DataStax PHP Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-driver-user+unsubscribe@lists.datastax.com.

Ярослав Харченко

unread,
Mar 15, 2017, 4:34:29 PM3/15/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
Ok, thanks. I've installed php7.0
apt-get install g++ make cmake libuv-dev libssl-dev libgmp-dev php7.0 php7.0-dev openssl libpcre3-dev git

git clone https://github.com/datastax/php-driver.git /usr/src/datastax-php-driver

cd /usr/src/datastax-php-driver

git submodule update --init

cd ext

./install.sh


root@web1:~# ls -l /usr/lib/php/20151012/cassandra.so
-rwxr-xr-x 1 root root 4709808 Мар 15 22:06 /usr/lib/php/20151012/cassandra.so

vim /etc/php/7.0/mods-available/cassandra.ini

extension=cassandra.so

phpenmod cassandra


php -i | grep cassandra
/etc/php/7.0/cli/conf.d/20-cassandra.ini,
cassandra
cassandra.log => cassandra.log => cassandra.log
cassandra.log_level => ERROR => ERROR


But, still the same error:

php cass.php
PHP Fatal error: Uncaught Cassandra\Exception\LogicException: Not implemented in /root/cass.php:3
Stack trace:
#0 /root/cass.php(3): Cassandra\Cluster\Builder->build()
#1 {main}
thrown in /root/cass.php on line 3

I don't understand, why connection are not working. Please help me.

Michael Penick

unread,
Mar 15, 2017, 4:52:43 PM3/15/17
to php-dri...@lists.datastax.com
I just remembered I've seen this issue before: https://datastax-oss.atlassian.net/browse/PHP-133

From the ticket:

There is likely an older version (< 2.1.0) of the cpp-driver shared library in "/usr/local/lib" or "/usr/lib" that's being favored over a newer version of the driver in "/usr/lib/x86_64-linux-gnu/"?

Only supporting protocol v1/v2 and not having "cass_cluster_set_use_schema()` sounds like an older version of the cpp-driver is being used at runtime.

Let me know if this helps.

Mike


Ярослав Харченко

unread,
Mar 16, 2017, 10:55:31 AM3/16/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
No, I'm additional cpp-driver are not installed, only the one that
git submodule update --init (https://github.com/datastax/cpp-driver.git)
but, I've reinstall debian, installed required dependencies and I’ve the same error:

Thomas Lété

unread,
May 2, 2017, 9:25:56 AM5/2/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi,

I've exactly the same problem. I used v1.2.2 with no problem and wanted to upgrade bug then I receive the exact same error...
I'm using php v7.0.15 from Ubuntu 16.04.4.

Do you need more information ?

Thanks !

Michael Penick

unread,
May 2, 2017, 9:58:06 AM5/2/17
to php-dri...@lists.datastax.com
What version of libuv are you running? There's an issue if you have libuv 0.10.x installed: https://datastax-oss.atlassian.net/browse/PHP-163

As a stop gap this can be resolved by installing libuv 1.x. We have prebuilt packages for Ubuntu: http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependencies/libuv/v1.11.0/

Mike

Thomas Lété

unread,
May 16, 2017, 6:06:46 AM5/16/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
Thanks Michael, I tested today and it works :-)
> To unsubscribe from this group and stop receiving emails from it, send an email to php-driver-us...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages