Hello, I’m trying to install latest SDK 4.0.0 on Windows Server 2019 with IIS and PHP 8.1.11, I spent several hours trying to make it work and still have some issues. I’m a frontend developer with little backend/noSQL/C++ experience and that’s probably the biggest issue here
Initially I couldn’t compile the extension, for some reason variable PHP_DIR was missing in configure.js so I just simply added it to this file. After this, I successfully compiled the extension and found out that the C++ compiler I used (v14.33) isn’t compatible with the one that my PHP was originally compiled (v14.29) - found a way to overcome that problem too. Despite solving those issues, I still can’t make the SDK to work. Couchbase 7.1.1 is on the same server. I installed composer package as per documentation and created a test file with the hello world code and got this error:
PHP Fatal error: Uncaught Couchbase\Exception\CouchbaseException: The I/O operation has been aborted because of either a thread exit or an application request. in C:\Users\xxxxxxxxxx\couchbase-php-client\src\wrapper\connection_handle.cxx:453
Stack trace:
#0 D:\cbtest\vendor\couchbase\couchbase\Couchbase\Cluster.php(56): Couchbase\Extension\createConnection('xxxxxxxxxxx...', 'couchbase://loc...', Array)
#1 D:\cbtest\index.php(15): Couchbase\Cluster->__construct('couchbase://loc...', Object(Couchbase\ClusterOptions))
#2 {main}
thrown in C:\Users\xxxxxxxxxx\couchbase-php-client\src\wrapper\connection_handle.cxx on line 453
Fatal error: Uncaught Couchbase\Exception\CouchbaseException: The I/O operation has been aborted because of either a thread exit or an application request. in C:\Users\xxxxxxxxxx\couchbase-php-client\src\wrapper\connection_handle.cxx:453
Stack trace:
#0 D:\cbtest\vendor\couchbase\couchbase\Couchbase\Cluster.php(56): Couchbase\Extension\createConnection('xxxxxxxxxx...', 'couchbase://loc...', Array)
#1 D:\cbtest\index.php(15): Couchbase\Cluster->__construct('couchbase://loc...', Object(Couchbase\ClusterOptions))
#2 {main}
thrown in C:\Users\xxxxxxxx\couchbase-php-client\src\wrapper\connection_handle.cxx on line 453
SDK 3.2.2 on the same server, with the same PHP and the same client library works fine, not sure what I’m doing wrong?
You’ve gotten impressively far with this, so I should congratulate you. Windows doesn’t often have compiler toolchain handy/compatible, so great news you got to a loadable module.
We worked with Pierre Joye from the PHP project quite a while ago to add Windows binaries to PECL distribution. Pierre maintained that for the community in conjunction with some help from Microsoft. My recollection was that he had to very carefully get the build toolchain in place to work with PHP and extensions. An out of the box compiler and set of flags may be a challenge. You may want to check with your PHP distribution’s community to see if there are binaries for this extension or can be provided. If there’s a build toolchain there, it’d probably yield better results.
Since you’ve gotten this far, my other recommendation would be to see if there is a crash dump and a tool like WinDbg can give you some more info on precisely what went wrong or something you can post here. As you’ve probably already seen in the code, that line is just trying to return an error code. It looks like it might be crashing?
Hello @SG, and a warm welcome to the forums indeed!
If you followed the instructions found on our couchbase-php-client GitHub repository found here, then you would have cloned and compiled the latest, developer version of the PHP client found on our GitHub repository. However, the source files installed by composer are the set 4.0.0 release of the Couchbase PHP Client. It’s possible that this mismatch is causing issues, to remedy this, could you please try to replace your path\to\vendor\couchbase\couchbase directory with the couchbase-php-client directory that you cloned, and rename it to couchbase.
It may also be worth confirming that you copied the generated php8ts.dll, php_couchbase.dll and couchbase_php_wrapper.dll files into your php’s ext directory. (Note that couchbase_php_wrapper.dll was renamed from couchbase_php_core.dll).
If none of this seems to fix your issue, could you try setting error_log = syslog and adding couchbase.log_level = debug in your php.ini as laid out in our documentation here, and running your program again to see what’s happening under the hood.