How do I enable php-intl on Local?

Hey everyone, thanks for your patience with this!

I wish I had a solution for you right now, but I’ve been cracking at this for a bit now and haven’t been able to get the intl extension to build for MacOS. From what I can tell, it seems like intl is no longer compiled as a separate extension, and instead, needs to be compiled when building php itself.

I’m working with the Local team to get this extension compiled when building PHP itself, but I don’t have an exact time for when this will be ready.

If anyone is curious about the general workflow for what was tried, here we go:


  1. Right-click on the site you wish to install the extension for and “Open Site Shell.”

  2. Download and untar extension from PECL - https://pecl.php.net/package/intl

  3. Change to the extension directory

    cd ~/Downloads/intl-3.0.0/intl-3.0.0
    
  4. Update prefix in phpize and php-config to point to the php that is bundled with Local. This path would look something like:

    /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+10/bin/darwin/
    
  5. Run phpize

  6. Run ./configure

    • Check for missing dependencies.
    • This seemed to be fixed with brew install intltool icu4c gettext
    • Then adding echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc this to the shell environment
  7. Run make, which results in errors similar to: PHP :: Bug #72879 :: Pecl install intl make error with PHP 7.0.8

From here, I went to see what others in the space are doing, and at least with Homebrew’s php@7.4 formula, they are compiling php with a specific extension:

3 Likes