How To Become A Programmer Without A Degree & Experience

How to Solve “You must enable the intl extension to use CakePHP”


 

 

Introduction

When you first install CakePHP3, 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 worked for me.

The Terminal command might intimidate you, but don’t worry!
I’m going to share every step I took.

 

Environment

macOS High Sierra
XAMPP 7.0.26
CakePHP3

 

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 a 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/XAMPP/xamppfiles/bin/php → Step5

 

Step4: Change Path

Users-MacBook:~ user$ PATH=”/Applications/XAMPP/xamppfiles/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/XAMPP/xamppfiles/etc/php.ini , and find extension=intl.so

;extension=intl.so

extension=intl.so   // Remove semicolon

Then, restart XAMPP.

 

Another way to install Intl

The above steps may not work for you. In this step, I’ll introduce you a different way.

August, 2018
This way is no longer available.

1. Open a new window in Terminal.

2. Search available intl version.

Users-MacBook:~ user$ brew search intl

 

You’ll get the result like this:

homebrew/php/php53-intl     homebrew/php/php55-intl     homebrew/php/php70-intl
homebrew/php/php54-intl     homebrew/php/php56-intl     homebrew/php/php71-intl

 

3. Install Intl according to your PHP version.

Users-MacBook:~ user$ brew install homebrew/php/php70-intl

 

4. Activate intl & Restart XAMPP

Open /Applications/XAMPP/xamppfiles/etc/php.ini , and find extension=intl.so

;extension=intl.so
extension=”/usr/local/Cellar/php70-intl/7.0.27_24/intl.so” ← Add (change the path according to your version.)

Then, restart XAMPP.

 
 

References

https://stackoverflow.com/questions/27886117/php-intl-installation-on-xampp
https://stackoverflow.com/questions/36408338/compiling-php-intl-extension-on-mac-book-pro-el-capitan-10-11-4