简体   繁体   中英

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?

The cli uses a different php.ini file (eg /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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM