如何在macOS Mojave上启用PHP Intl扩展? [英] How to enable PHP Intl extension on macOS Mojave?
问题描述
我正在尝试在macOS Mojave上安装Magento(2.3.0). Magento显示PHP Extension intl.
丢失.
I'm trying to install Magento (2.3.0) on macOS Mojave. Magento shows PHP Extension intl.
is missing.
我尝试了以下解决方法:
I tried the below to resolve:
- 使用
cp /etc/php.ini.default php.ini
复制php.ini
- 已删除;"在
extension=php_intl.dll
之前
- 重新启动Apache
sudo apachectl restart
- Made a copy of php.ini using
cp /etc/php.ini.default php.ini
- Removed ";" before
extension=php_intl.dll
- Restart Apache
sudo apachectl restart
但是以上问题仍未解决.
But the above did not resolve.
在检查php -v
时,我看到以下错误:
On checking php -v
, i'm seeing the below error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll,
0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-
non-zts-20160303/php_intl.dll in Unknown on line 0
PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
/usr/lib/php/extensions/no-debug-non-zts-20160303
下只有2个文件,分别是opache.so
和xdebug.so
There are only 2 files under /usr/lib/php/extensions/no-debug-non-zts-20160303
namely opache.so
and xdebug.so
如何在macOS Mojave上安装或启用"PHP Extension intl"?
How can i install or enable "PHP Extension intl" on my macOS Mojave?
推荐答案
以下是对我有用的解决方案:
Here's a solution that worked for me:
- 找到所有已安装的PHP版本
brew list | grep php
- 删除所有版本的PHP
brew remove --ignore-dependencies --force php70 php71 php72
(基于您在上面看到的内容) - 安装PHP
brew install php72
(我选择7.2,一些供应商尚不支持7.3) - 运行命令
which php
应该会向您显示安装的PHP的路径.复制路径. - 更新您的bash_profile
vi ~/.bash_profile
并将此行添加到文件中:export PATH=/usr/local/php5/bin:$PATH
- 保存并运行此
source ~/.bash_profile
- 检查是否使用
php -m | grep intl
安装了 PHP Intl Extension .如果安装顺利,我们将列出 intl .如果没有,则未安装扩展程序.
- Find all PHP versions installed
brew list | grep php
- Remove all versions of PHP
brew remove --ignore-dependencies --force php70 php71 php72
(based on what you see above) - Install PHP
brew install php72
(i chose 7.2, 7.3 is not supported yet by several vendors) - Run the command
which php
should show you the path to the installed PHP. Copy the path. - Update your bash_profile
vi ~/.bash_profile
and add this line to the file:export PATH=/usr/local/php5/bin:$PATH
- Save and run this
source ~/.bash_profile
- Check if PHP Intl Extension is installed using
php -m | grep intl
. If the installation went well, we will see intl listed. If not the extension is not installed.
我认为从PHP 7(不确定版本)开始,这些扩展默认情况下可用,我们无需在 php.ini 文件中明确启用它们.
I think from PHP 7 (not sure of the version), the extensions are available by default and we need not enable them in php.ini file explicitly.
这篇关于如何在macOS Mojave上启用PHP Intl扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!