How to enable the intl extension to use CakePHP or Magento on mac

Home > Blog > Learning > How to enable the intl extension to use CakePHP or Magento on mac

Introduction

When you first install CakePHP3 or Magento, I guess “enable the intl extension” is the first hurdle. It’s been a while since I first dealt with this problem, but I remember it was complicated a little. Today, I’m going to introduce some solutions that worked for me. The Terminal command might intimidate you, but don’t worry! I’m going to share every step I took.

Environment

macOS Catalina MAMP 5.7 CakePHP3 / Magento

Let’s get started!

Step1: Open Terminal and Check if Homebrew is installed

Users-MacBook:~ user$ which brew If it returns: /usr/local/bin/brew → Step3 not found → Step2

Step2: Install Homebrew

Access to https://brew.sh/, then copy and Paste an install command.Users-MacBook:~ user$ Copy & Paste Here

Step3: Check PHP path

Users-MacBook:~ user$ which php If it returns: /usr/bin/php → Step4 /Applications/MAMP/bin/php/php7.2.7/bin → Step5

Step4: Change Path

Users-MacBook:~ user$ PATH=”/Applications/MAMP/bin/php/php7.2.7/bin:${PATH}”

Step5: Install icu4c

Users-MacBook:~ user$ brew install icu4c

Step6: Install intl

Users-MacBook:~ user$ sudo pecl update-channels Users-MacBook:~ user$ sudo pecl install intl If you get “Cannot find autoconf” message:Users-MacBook:~ user$ brew install autoconf Succeed → Step7 Failed → Skip Step7

Step7: Activate intl & Restart XAMPP

Open /Applications/MAMP/bin/php/php7.2.7/conf/php.ini , and find extension=intl.so;extension=intl.so ↓ extension=intl.so   // Remove semicolon Then, restart MAPP.

STEP8: Check the installation

There are two ways to check if our intl installation is success. First is using the following command
$ php -m | grep intl

References

https://stackoverflow.com/questions/27886117/php-intl-installation-on-xampp https://medium.com/better-programming/how-to-install-a-php-7-2-on-macos-10-15-catalina-using-homebrew-and-pecl-ad5b6c9ffb17 https://stackoverflow.com/questions/36408338/compiling-php-intl-extension-on-mac-book-pro-el-capitan-10-11-4 http://budiirawan.com/install-php-intl-extension-os-x/ https://stackoverflow.com/questions/27886117/php-intl-installation-on-xampp

Leave a Reply

Your email address will not be published.