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;
- Extracted the package and added
php_cassandra.dll
toc:xamppphpext
- Added
extension=php_cassandra.dll
inphp.ini
file inc:xamppphpphp.ini
- 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.
- Download compatible version
- Unzip and copy php_cassandra.dll to c:/xampp/php/ext/
- Add “extension=php_cassandra.dll” to php.ini file
- Restart apache server.