Running Composer with MAMP: Unable to load dynamic library mcrypt.so - php

I am attempting to get composer running on my Mac and using MAMP. I installed composer using
sudo curl -sS https://getcomposer.org/installer | phpmamp
So, in .bash_profile, I've added the following alias
alias phpmamp='/Applications/MAMP/bin/php/php5.5.14/bin/php'
After installing, I also moved composer.phar to /usr/local/bin/composer
Now I try to run composer and I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so' - dlopen(/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so, 9): Library not loaded: /usr/local/lib/libmcrypt.4.4.8.dylib
Referenced from: /usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so' - dlopen(/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so, 9): Library not loaded: /usr/local/lib/libmcrypt.4.4.8.dylib
Referenced from: /usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so
Reason: image not found in Unknown on line 0
??+?%
Here's my php version info:
PHP 5.5.14 (cli) (built: Jul 25 2014 17:02:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
I've tried adding the following to my bash_profile with no luck/difference:
PATH=/Applications/MAMP/bin/php/php5.5.17/bin:$PATH

You're trying to load PHP 5.3 libraries into a PHP 5.5 installation. You need to install a PHP 5.5 version of mcrypt. If you're using Homebrew to manage your PHP install (which you should), brew install php55-mcrypt will do the trick.

Related

"PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/http.so'" after downgraded PHP from 8.1 to 7.1

We have a requirement that needs to downgrade PHP from 8.1 to 7.1 in our Ubuntu 18 server.
sudo update-alternatives --set php /usr/bin/php7.1
After the downgrade, we're seeing PHP Startup error everytime we check php -v
Below is the exact error text:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/propro.so' - /usr/lib/php/20160303/propro.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/raphf.so' - /usr/lib/php/20160303/raphf.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/http.so' - /usr/lib/php/20160303/http.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 7.1.33-47+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jun 27 2022 08:15:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33-47+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
The missing libraries are really not found in the said directory as I checked.
/usr/lib/php/20160303
We have tried reinstalling as suggested from other forum with same error.
sudo apt-get install --reinstall `dpkg -l | grep 'ii php7.1' | awk '{ printf($2" "); next}'`
It works for them but not in ours.
I hope I can get help here. Thanks in advance.
By the way, I'm not a Linux and PHP developer. Just starting getting into it.
--reinstall will only reinstall the things that are installed, but it looks like you actually removed a number of modules. The propro, raphf, and http modules are not standard and are not installed by default. If you don't actually need/use them, you can just disable them so that they don't try to load:
phpdismod propro raphf http
However, if your app requires these modules, you'll need to explicitly add them:
apt install php7.1-propro php7.1-raphf php7.1-http

Phalcon failed install on mac m1

I followed those step to install phalcon on my mac m1, my php version is 7.4.20
step1: brew tap tigerstrikemedia/homebrew-phalconphp
step2: brew install php72-phalcon
step3: add this line to php.ini
extension=/opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so
step4: php -v, shows the error
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so' (tried: /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so (dlopen(/opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so, 9): Symbol not found: __zval_ptr_dtor
Referenced from: /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so
Expected in: flat namespace
in /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so), /opt/homebrew/lib/php/pecl/20190902//opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902//opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so.so, 9): image not found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so' (tried: /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so (dlopen(/opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so, 9): Symbol not found: __zval_ptr_dtor
Referenced from: /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so
Expected in: flat namespace
in /opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so), /opt/homebrew/lib/php/pecl/20190902//opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902//opt/homebrew/Cellar/php72-phalcon/3.4.2/phalcon.so.so, 9): image not found)) in Unknown on line 0
PHP 7.4.20 (cli) (built: Jun 3 2021 19:10:14) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
How can I solve this problem? Thanks!!
The "72" in "php72-phalcon" refers to PHP 7.2, but you are using PHP 7.4, so it's not going to be compatible - extensions need to be built against the correct version of PHP in order to run. The version of Phalcon it's installing (3.4.2) is also out of date, because that was the last version supported on that version of PHP.
The instructions for installing Phalcon 4.0 on a Mac are here: https://docs.phalcon.io/4.0/en/installation#macos
They refer to a different homebrew repository:
brew tap phalcon/extension https://github.com/phalcon/homebrew-tap
brew install phalcon

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

OSX 10.10 Yosemite local development environment broke - PHP mcrypt Issue

I a running a local development environment on my MBP using osx yosemite, php 5.5.14, apache 2.4 mysql (sometimes) and a few things installed via brew.
I tried to run a CMS locally and ran into an issue where it stated i needed mcrypt; so i tried to install it and was promptly tole mcrypt was already installed.
Did a little research, tried to reinstall it and now I'm faced with this error when running php -v. Also this has stopped m dev enviroment from showing me my site and all it says now is 'it works!'
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/Cellar/php55-mcrypt/5.5.21/mcrypt.so' -
dlopen(/usr/local/Cellar/php55-mcrypt/5.5.21/mcrypt.so, 9): image not
found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library
'/usr/local/Cellar/php55-mcrypt/5.5.21/mcrypt.so' -
dlopen(/usr/local/Cellar/php55-mcrypt/5.5.21/mcrypt.so, 9):
image not found in Unknown on line 0
PHP 5.5.21 (cli) (built: Feb 12 2015 20:17:17)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Any help would be very appreciated and thanks in advance.
Make sure that you're loading the mcrypt.so extension in your php.ini file. Also, you may need to run brew install mcrypt php55-mcrypt to get the PHP extension.
Find the location of your ini with:
php -i | grep php.ini
Edit the file and add extension=mcrypt.so to the file, save and restart Apache.

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.

Categories