0

I am on a bitnami MAMP stack. I am using the php shipped with MAMP as my default PHP installation.

I have installed composer using php scripts:

https://getcomposer.org/download/

Now whenever I type composer in my bash terminal, I get the following error:

dyld: Library not loaded: /bitnami/mampstackDev-osx-x64/output/common/lib/libcrypto.1.0.0.dylib
  Referenced from: /Applications/mampstack-7.1.15-0/php/bin/php.bin
  Reason: image not found

Seems to be some problem with loading of libcryptolib.

[UPDATE 03-12-2019] One comment i would like to add is that this problem is happening from the time i changed my default PHP installation from /usr/bin/php to Mampstack PHP. Once i reverted the default php installation it started working

saurav
  • 5,388
  • 10
  • 56
  • 101
  • please clear composer cache and then re try – Ashok Songara Dec 02 '19 at 10:20
  • Are you on Mac Host? Could this be a similar issue? https://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-found – k0pernikus Dec 02 '19 at 10:24
  • Is the issue exclusive to Composer? I mean, running `php` from command-line doesn't trigger that message? – Álvaro González Dec 02 '19 at 10:26
  • @AshokSongara I am getting the same error when I am typing composer clear cache – saurav Dec 03 '19 at 07:48
  • @ÁlvaroGonzález I am able to execute PHP cli properly – saurav Dec 03 '19 at 07:49
  • composer diagnose using this command may you will get the exact error I think its installation error maybe or try ```brew upgrade node``` – Ashok Songara Dec 03 '19 at 07:54
  • composer diagnose is returning the same result...it seems the composer program itself is not running – saurav Dec 03 '19 at 12:08
  • In the Linux environment, the `ldconfig` command must be run (as super-user) to update the loader cache, which is necessary to resolve library names. The loader doesn't actually look through the filesystem to find the right file: it uses the cache. (It won't find a library that isn't in the cache even if it is in the filesystem.) Most of the time, this command is run automatically by `make install` scripts, but not every time. Try `sudo ldconfig` and see if that fixes things. *(First make sure that the library-file IS there, o'course.)* – Mike Robinson Dec 04 '19 at 16:27
  • By default, composer should be included in `/Applications/mampstack-7.1.15-0/php/bin/composer`. Could you try to load the environment `/Applications/mampstack-7.1.15-0/use_mampstack` and run `composer --help` then? – David Gomez Dec 05 '19 at 16:53

1 Answers1

1

The reason why this is happening is because neither Bitnami MAMP installer nor the use_mampstack startup script are setting the correct path to libraries, even though they are bundled and provided in ./common/lib directory (relative to your MAMP's installation path, for example /Applications/mampstack-7.2.29-2/).

To fix the issue, simply create symbolic links to libcrypto and libssl like this:

ln -s /Applications/mampstack-7.2.29-2/common/lib/libcrypto.1.1.dylib /usr/local/lib
ln -s /Applications/mampstack-7.2.29-2/common/lib/libssl.1.1.dylib /usr/local/lib

Of course, adjust library and MAMP stack version names to what you have installed on your system.