nginx error : AH01071: Got error 'PHP message: PHP Fatal error: Class ‘CouchbaseCluster’ not found in [appName.module]
I have already installed PHP SDK and added extension =couchbase.so in php.ini
but still, I am getting this error.
I have checked the phpinfo() file but couchbase is not showing in that
I am using couchbase Enterprise Edition 5.0.1 build 5003 and the latest PHP SDK.
Installed packages, channel pecl.php.net:
=========================================
Package Version State
couchbase 2.6.0 stable
pcs 1.3.3 beta
In your phpinfo() you should be able to see the path to config is beeing used. You might be using incorrect php.ini when adding couchbase extension (also I noticed nginx error in your logs, but you said you are using apache2).
Something like this.
it appears that php is not able to load dynamic library
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/pcs.so' -
/usr/lib/php/20131226/pcs.so: cannot open shared object file: No such file or directory in Unknown on line
0
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/couchbase.so' -
/usr/lib/php/20131226/couchbase.so: cannot open shared object file: No such file or directory in Unknown
on line 0
I have removed pcs.so from the list of extension and I still have the error for couchbase.so PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/couchbase.so' - /usr/lib/php/20131226/couchbase.so: cannot open shared object file: No such file or directory in Unknown on line 0
How did you install couchbase extension? If you’ve used pecl install, then make sure pecl was using correct PHP interpreter. If you installed it from tarball, then make sure that you use phpize from PHP interpreter you use with apache2
If this does not give you version you are using, then probably you have multiple PHP interpreters installed and couchbase.so got installed somewhere else when you execute sudo pecl install couchbase
On my system /usr/bin/pecl is just a shell script, which runs system PHP interpreter with peclcmd.php as argument:
I have noticed an issue that might be the causing the PHP SDK not found error
The problem is the output of php --ini and phpinfo() is totally different maybe that is causing the issue,.
php --ini output is as follows.
root@techpatrol:/# php --ini
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/couchbase.so' -
/usr/lib/php/20131226/couchbase.so: cannot open shared object file: No such file or directory in Unknown on line 0
Configuration File (php.ini) Path: /etc/php/5.6/cli
Loaded Configuration File: /etc/php/5.6/cli/php.ini
Scan for additional .ini files in: /etc/php/5.6/cli/conf.d
Additional .ini files parsed: /etc/php/5.6/cli/conf.d/10-mysqlnd.ini,.
the loaded configuration files are different.
I wanted the PHP SDK to be installed for /opt/plesk/php/5.6 but instead, it got installed for /etc/php/5.6.
also the output of the pecl install couchbase says that it installed couchbase.so in mv /tmp/pear/temp/pear-build-rootaxotS5/install-couchbase-2.6.0//usr/lib/php/20170718/couchbase.so /usr/lib/php/20170718/couchbase.so
but the php is trying to load the couchbase.so in PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/couchbase.so'
Yes, this definitely matters.
The rule of thumb would be either leave only one interpreter on the system and use it everywhere (both CLI and httpd) or always check which interpreter and which config you are using in every single case.