phpcassandra-2.1datastax-php-driver

running Cassandra from php shell command (using datastax php-driver)


I am able to run it through the browser but not from command line

ie php test.php

$raw = Cassandra::cluster()
              ->withContactPoints('localhost')
              //->withCredentials($this->username, $this->password)
              ->build();
 var_dump($raw);                       

die;

from browser:

object(Cassandra\DefaultCluster)#2 (0) { }

command line:

PHP Fatal error: Class 'Cassandra' not found in /var/www/html/test.php on line 2

Is it possible to get same from command line as well?


Solution

  • The cli uses a different php.ini file (e.g. /etc/php/7.0/cli/php.ini & /etc/php/7.0/fpm/php.ini). You are probably not including the extension in the cli one.