Installing PHP's Intl Extension on XAMPP
Problem:
Users may encounter difficulties installing the intl extension on XAMPP for Mac, despite following instructions. The php -m command fails to detect the installed extension, leading to composer and CakePHP errors.
Solution:
The solution involves using the following steps:
-
Check PHP Path: Determine the currently set PHP path using the "which php" command.
-
Adjust PATH: If the path is not "/Applications/XAMPP/xamppfiles/bin/php," modify the system path to include it: "PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}""
-
Install icu4c: Use Homebrew to install icu4c via "brew install icu4c."
-
Install Intl via PECL: Execute the commands "sudo pecl update-channels" and "sudo pecl install intl" to install the Intl extension.
-
Verify Installation: Check if the extension was installed successfully with "php -m | grep intl."
-
Configure php.ini: Add or uncomment the "extension=intl.so" line in the php.ini file located at "/Applications/XAMPP/xamppfiles/etc/php.ini" and restart Apache.
Additional Notes:
- If "intl" installation fails, ensure Autoconf is installed. Use Homebrew for "brew install autoconf automake" or install manually.
- After installing "intl," clear APC cache (if using): "apcu_clear_cache();."
- If the intl extension remains undetected, try adding the following lines to the php.ini file before the Apache restart:
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20151012/"
extension=intl.so
Copy after login
The above is the detailed content of Why Can\'t I Install PHP\'s Intl Extension on My XAMPP for Mac?. For more information, please follow other related articles on the PHP Chinese website!