Skip to content
Advertisement

Installing PHP Cassandra Driver – XAMPP on Windows

I am trying to install prebuilt binaries of Cassandra PHP driver on my windows xampp installation.

I downloaded the package from here https://pecl.php.net/package/cassandra.

I did the following;

  1. Extracted the package and added php_cassandra.dll to c:xamppphpext
  2. Added extension=php_cassandra.dll in php.ini file in c:xamppphpphp.ini
  3. Restarted the Apache server

Now if I check with command php -m, I can see that the Cassandra module is loaded but I cannot see it in phpinfo().

My doubt is where to place cassandra PHP files which I got from pecl (classes etc.) to this.

Now I am getting the error below;

“Fatal error: Uncaught Error: Class ‘Cassandra’ not found” if I run some php. Same code was working fine with Linux servers.

I understand that I need to add those Cassandra PHP files somewhere.

How do I go about this?

Advertisement

Answer

I got compatible version from here:

Datastax Cassandra Drivers: http://downloads.datastax.com/php-driver/windows/cassandra/v1.3.2/

Things to take care.

  • Find PHP Version : php -i | FINDSTR /C:”PHP Version”
  • Find Architecture : php -i | FINDSTR /C:”Architecture”
  • Find Compiler : php -i | FINDSTR /C:”Compiler”
  • Find Thread Safety : php -i | FINDSTR /C:”Thread Safety”

For me it was PHP v7.1, x86, MVC14, Thread Safety Enabled.

So the compatible version is cassandra-php-driver-1.3.2-7.1-ts-vc14-x86.zip

  • ts => Thread Safe
  • nts => Non Thread Safe
  • vc14 => MVC14

Now it is working perfectly fine. Just 4 steps required.

  1. Download compatible version
  2. Unzip and copy php_cassandra.dll to c:/xampp/php/ext/
  3. Add “extension=php_cassandra.dll” to php.ini file
  4. Restart apache server.
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement