Class 'AMQPConnection' not found. AMQP and PHP api version conflict - php

After one of PHP updates (ubuntu) I got an error Class 'AMQPConnection' not found in my application.
I reinstalled latest stable version (1.7.1) of amqp via pecl
sudo pecl uninstall amqp
sudo pecl install amqp
It asks me:
downloading amqp-1.7.1.tgz ...
Starting to download amqp-1.7.1.tgz (79,905 bytes)
..................done: 79,905 bytes
18 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Set the path to librabbitmq install prefix [autodetect] :
When I choose one of the variants - builds fails, error always like
configure: error: Please reinstall the librabbitmq distribution itself or (re)install librabbitmq development package if it available in your system
ERROR: `/tmp/pear/temp/amqp/configure --with-librabbitmq-dir=20121113' failed
If I choose autodetect, installation proccessed successfully.
Then I add extension=amqp.so into php.ini and get an error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/amqp.so' - /usr/lib/php5/20131226/amqp.so: cannot open shared object file: No such file or directory in Unknown on line 0
I found amqp.so via
locate amqp.so
It display
/usr/lib/php5/20121212/amqp.so
Then I change extension=amqp.so to the full path /usr/lib/php5/20121212/amqp.so
And I get very interesting error
PHP Warning: PHP Startup: amqp: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
As I understand, PHP compiled with version newest than Amqp.
But it is the latest amqp library version.
Pecl shows:
Package Stable/(Latest) Local
amqp 1.7.1 (stable) 1.7.1 Communicate with any AMQP compliant server
PHP version is 5.6.4
PHP 5.6.4-4ubuntu6 (cli) (built: Apr 17 2015 15:47:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend
Technologies
with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans

Related

PHP can not load Imagick library - PHP Startup: Unable to load dynamic library

I have High Sierra OS - Version 10.13.6
PHP Version: PHP 7.1.9
when I try to do command php -v always appear error like this:
PHP Startup: Unable to load dynamic library
'/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so'
- dlopen(/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so,
9): Library not loaded:
/usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.5.dylib
Referenced from:
/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library
'/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so'
- dlopen(/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so,
9): Library not loaded:
/usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.5.dylib
Referenced from:
/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so
Reason: image not found in Unknown on line 0 PHP 7.1.9 (cli) (built:
Sep 14 2017 10:05:35) ( NTS ) Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.9, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans
AFAIK, my php.ini failed to load imagick library.
I already install Imagick with brew,
there is a file imagick.so inside folder /usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/.
I already search many sources for this issue, I found many similar issues too in StackOverflow, it seems similar to mine but still not fixed my issue.
I can still run PHP script obviously, but cannot do some manipulation image with Imagick.
Try:
sudo pecl uninstall imagick && sudo pecl install imagick
For debugging I suggest you move the dep to a folder easy to debug, such as in /User/<you>/Documents/. You can load it from the absolute path:
extention="/User/<you>/Documents/<project and check if it's a path issue.
I think that you are trying to install the dependency that is older than the current version of PHP, because you are loading the extention from php56 but you are using php71
https://stackoverflow.com/a/50529784/5893008

PHPize Compiling Mongo Driver for Ubuntu API Options Not Matching

I'm running into a problem getting a valid mongo driver compiled for the API version of PHP that I'm running. Using php - v
PHP 5.6.24-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
What is happening is that even when I use what I think is the correct phpize it is still configuring the build for an older API version.
When I run /usr/bin/phpize -v here is what I get:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
BUT when I try to use the compiled version of the mongo driver I get this warning message:
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
Here is the whereis php output:
php: /usr/bin/php /usr/bin/php5.6 /etc/php /usr/lib/php /usr/share/php5.6-mysql /usr/share/php5.6-common /usr/share/php5.6-xml /usr/share/php5.6-curl /usr/share/php5.6-mcrypt /usr/share/php5.6-intl /usr/share/php /usr/share/php5.6-readline /usr/share/php5.6-gd /usr/share/php5.6-opcache /usr/share/php5.6-json /usr/share/php5.6-mbstring /usr/share/man/man1/php.1.gz
Can someone please give me step by step instructions on how to properly compile the Mongo driver on Ubuntu 14.04?
I don't know what command you are exactly using, but you should be fine running pecl install on ubuntu.
So to install this official PHP driver for mongo: https://pecl.php.net/package/mongodb just run:
pecl install mongodb
and you should be good to go. Maybe it tells you that some libs are missing, but you can use apt-get install to install them afterwards.
You can read more about the driver here
If pecl command is not found, install it using
apt-get install php-pear

PEAR claims php was compiled with old module

I just upgraded to php 5.6.4. When i do pear installs of various packages it complains that if have a module mismatch.
example:
sudo pecl install xdebug
Failed loading /usr/local/php-5.6.4/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so:
/usr/local/php-5.6.4/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so: undefined symbol: zend_execute_ex
Zend OPcache requires Zend Engine API version 220131226.
The Zend Engine API version 220100525 which is installed, is outdated.
PHP Warning: PHP Startup: PDFlib: Unable to initialize module
Module compiled with module API=20131226
PHP compiled with module API=20100525
However, 20131226 is php 5.6.4, 20100525 is 5.4 i believe. So oddly pear thinks the modules were compiled w/ 5.6 but the version of php is 5.4. Ive had this the other way around where the module is older than the php version a lot and typically just recompile those module. this one im a bit stumped.
[richv]$ php -v
PHP 5.6.4 (cli) (built: Jun 16 2015 16:08:30)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
[richv]$ pear version
PEAR Version: 1.9.5
PHP Version: 5.6.4
Zend Engine Version: 2.6.0
Running on: Linux dragon 3.10.0-229.4.2.el7.x86_64 #1 SMP Wed May 13 10:06:09 UTC 2015 x86_64
If you still have the old php version lying around, then pear/pecl probably still uses this php version - even if it shows the correct php version in pear version.
Try to change the php_bin pear config setting:
$ pear config-show
..
$ pear config-set php_bin /path/to/new/php

unable to download dynamic library

I want to install Composer on my Ubuntu 14.04LTS. But during installation I got this:
Some settings on your machine make composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The OpenSSL extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
Then in php.ini I remove semicolon';' in line ;extension=php_openssl.dll
After this I've got:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.6.2 (cli) (built: Oct 29 2014 06:55:23)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
Where can I get this library?
You use php.ini from windows machine. Use default from package manager. For Ubuntu apt-get.

Installing Thrift PHP from RPM Failing

I'm trying to install Thrift with PHP to my CentOS machine. Here's what I do and what goes wrong:
[root#x3430-20371 YACassandraPDO]# rpm -Uvh http://rpm.sys.fm/centos/6/x86_64/thrift-php-0.9.0-1.el6.x86_64.rpm
Retrieving http://rpm.sys.fm/centos/6/x86_64/thrift-php-0.9.0-1.el6.x86_64.rpm
error: Failed dependencies:
php(zend-abi) = 20090626 is needed by thrift-php-0.9.0-1.el6.x86_64
php(api) = 20090626 is needed by thrift-php-0.9.0-1.el6.x86_64
[root#x3430-20371 YACassandraPDO]# php -v
PHP 5.4.25 (cli) (built: Feb 18 2014 14:20:14)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Maybe you guys have any ideas how to fix it. Thanks!
Also when I'm building from Thrift source, I get this error:
[root#x3430-20371 thrift]# ./bootstrap.sh
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
configure.ac:89: installing `./config.guess'
configure.ac:89: installing `./config.sub'
configure.ac:26: installing `./install-sh'
configure.ac:26: installing `./missing'
compiler/cpp/Makefile.am: installing `./depcomp'
configure.ac: installing `./ylwrap'
lib/cpp/test/Makefile.am:178: variable `concurrency_test_SOURCES' is defined but no program or
lib/cpp/test/Makefile.am:178: library has `concurrency_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:187: variable `processor_test_SOURCES' is defined but no program or
lib/cpp/test/Makefile.am:187: library has `processor_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:195: variable `processor_test_LDADD' is defined but no program or
lib/cpp/test/Makefile.am:195: library has `processor_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:184: variable `concurrency_test_LDADD' is defined but no program or
lib/cpp/test/Makefile.am:184: library has `concurrency_test' as canonical name (possible typo)
[root#x3430-20371 thrift]#

Categories