I’m at the end of my patients, God knows what was update, MAMP or Brew or something else but I ended with this nasty error for Redis integration:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/redis.so' - dlopen(/Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/redis.so, 9): image not found in Unknown on line 0
Whaaat was that?
Ok, I know I don’t have the redis library or php is not able to load dynamically the library therefore I fixed this couple times through different methods, like:
- install the library through
brew
- install
phpredis
through macport
But, I have MAMP I don’t want to mess with brew if it’s not necessary, I want to keep it simple and mostly I need a damn quick solution.
I need redis
in my project otherwise I would disable the extension from php.ini
.
Solution:
Anyway, decided to take the straight approach. The error says it doesn’t have the redis.so
in that location. A short search on google revealed a github project with Pecl redis Extension for MAMP 3.x & 4.x
I forked the project so it would be available at any point at this location: https://github.com/obsergiu/php-redis-mamp. And:
- From the upper error got the version of php:
php5.6.32
- Checked if the path from the upper error exists:
- Open Finder
- Pressed the combination of keys
CMD+SHIFT+G
or from top menu Go > Go to Folder
and past the path from the error: /Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/
if it opens we’re good to go and skip (c).
- In terminal just run the following command which will create the entire folder structure (the folder might look different for a different version of PHP):
mkdir -p /Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/
- Download from github the redis version closer to what php version you have and save to(created directory):
/Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/
That’s it, that’s everything. I saved the file in the location it was looked by MAMP and everything works properly.