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.