Having trouble installing the php-redis extension ("Unable to load dynamic library"), or any php extension

Issue Summary

Working with a Sage site on Local, and need the php-redis extension installed. Installation is fine, but when trying to use the php-redis extension I’m getting the warning on site startup: Warning: PHP Startup: Unable to load dynamic library... symbol not found in flat namespace '_PHP_MD5InitArgs')

Replication Steps:

  • Install the php-redis extension (follow instructions at: phpredis/INSTALL.md at develop · phpredis/phpredis · GitHub)
  • Copy the resulting redis.so to the appropriate extensions directory (in my case /Users/{user}/Library/Application Support/Local/lightning-services/php-7.4.30+5/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/redis.so)
  • Add extension = {{extensionsDir}}/redis.so to /Users/{user}/Local Sites/{site-name}/conf/php/php.ini.hbs
  • Start site in Local, see error in Wordpress version row.

System Details

  • Running Local 6.7.0+6347
  • Upgraded to Ventura 13.3.1 (a) - tried first on OSX Monterey
  • Intel Macbook Pro

local-logs.zip (240.3 KB)

That kind of error makes sense, and makes me think that compiling this extension for Local’s Lightning Services likely won’t work.

The reason for that is that these compiled PHP binaries aren’t easily extendible. This mostly is due to the security measures that Apple puts in place for software that is bundled with apps. In Local’s case, the PHP lightning services require a bunch of extra symbols (ie, libraries). We compile and link those manually, and sign them to run with Local so that it works on Macs.

The instructions you link to are basically that process of compiling an extension (redis) with the other things that you might compile (php itself, other extensions, etc)

Hey, thanks for your reply…

So, I’m guessing that a guide like this was valid pre-Lightning?

Also, I see that this feature (an extension manager add-on) might be dead in the water, but what about offering redis support by default?

Thanks again, much appreciated!

Yeah, that us under the “Classic” category, which basically means that it relates to when Local used Docker. While it was using Docker, you could treat it as a completely separate VM and install things like you would under an Ubuntu VM. With Lightning, you get a much faster site because the pieces of server software (php,mysql,nginx) are compiled for your specific OS and architecture.

Maybe not completely dead in the water, but it’s definitely harder than it seems. The main challenge is getting extensions compiled and configured across all OSes and architectures (ie Mac intel and Mac arm64, Windows, Linux)

That’s a good idea. It’s hard to prioritize this since it’s not a hard requirement of WordPress core, but I’d say upvote and reply to this feature request so that we can better understand what’s needed and how many users want it!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.