1

I have a Mac running Catalina. This includes PHP 7.3.11 which was installed by default - I haven't modified this in any way.

% php -v
PHP 7.3.11 (cli) (built: Jun  5 2020 23:50:40) ( NTS )

I was trying to run composer install to set up a CakePHP 4 project locally. This errors with

% composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cakephp/cakephp 4.1.6 -> satisfiable by cakephp/cakephp[4.1.6].
    - cakephp/cakephp 4.1.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.
  Problem 2
    - cakephp/cakephp 4.1.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/debug_kit 4.3.7 requires cakephp/cakephp ^4.1 -> satisfiable by cakephp/cakephp[4.1.6].
    - Installation request for cakephp/debug_kit 4.3.7 -> satisfiable by cakephp/debug_kit[4.3.7].

I've created /etc/php.ini and I can see this is being loaded:

% php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

The php.ini I created was a copy of php.ini.default which came with my Mac. This had the following line commented out

;extension=intl

I've uncommented this and saved as /etc/php.ini.

Now, I'm getting another error when executing php which says:

PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib/php/extensions/no-debug-non-zts-20180731/intl (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl, 0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-non-zts-20180731/intl), /usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so, 0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so)) in Unknown on line 0

How do you get intl extension installed under this environment? I've read that it should be included anyway by default in this version of PHP. Is this some Apple specific problem, or is there a workaround?

I found a solution (https://medium.com/@agaetis/solved-install-intl-php-extension-for-xampp-and-magento-for-macos-mojave-41fa42336fc6) using brew but this is for PHP 7.1, and doesn't work in this case.

Andy
  • 5,142
  • 11
  • 58
  • 131
  • Is this link related (1 year) ? https://stackoverflow.com/questions/55301299/mac-os-intl-extension-is-not-loaded – Ken Lee Jan 04 '21 at 14:08
  • 2
    I dont use 'shipped' versions of anything with OSuX ... brew php, it will have intl bundled in. – YvesLeBorg Jan 04 '21 at 14:34
  • @YvesLeBorg it seems the issue is that the version of PHP 7.3 shipped with macOS Catalina doesn't include the "intl" extension. The workaround I used was installing Homebrew and then switching back to PHP 7.3 as it installed PHP 8. There's a guide here https://medium.com/@romaninsh/install-php-7-2-xdebug-on-macos-high-sierra-with-homebrew-july-2018-d7968fe7e8b8 that a colleague gave me that works well if anyone comes across this post. – Andy Jan 04 '21 at 16:29
  • A search revealed this, also having the solution to use brew: [Mac OS: Intl extension is not loaded](https://stackoverflow.com/questions/55301299/mac-os-intl-extension-is-not-loaded) – Luuk Jan 04 '21 at 17:02

1 Answers1

0

You can use a docker image with apache and php (google : docker apache php github), set your project as a volume of your docker container with an external database or use this docker to build a new image with a DB.