如何在macOS Mojave上启用PHP Intl扩展? [英] How to enable PHP Intl extension on macOS Mojave?

查看:131
本文介绍了如何在macOS Mojave上启用PHP Intl扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在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:

  1. 使用cp /etc/php.ini.default php.ini
  2. 复制php.ini
  3. 已删除;"在extension=php_intl.dll
  4. 之前
  5. 重新启动Apache sudo apachectl restart
  1. Made a copy of php.ini using cp /etc/php.ini.default php.ini
  2. Removed ";" before extension=php_intl.dll
  3. 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.soxdebug.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:

  1. 找到所有已安装的PHP版本brew list | grep php
  2. 删除所有版本的PHP brew remove --ignore-dependencies --force php70 php71 php72(基于您在上面看到的内容)
  3. 安装PHP brew install php72(我选择7.2,一些供应商尚不支持7.3)
  4. 运行命令which php应该会向您显示安装的PHP的路径.复制路径.
  5. 更新您的bash_profile vi ~/.bash_profile并将此行添加到文件中: export PATH=/usr/local/php5/bin:$PATH
  6. 保存并运行此source ~/.bash_profile
  7. 检查是否使用php -m | grep intl安装了 PHP Intl Extension .如果安装顺利,我们将列出 intl .如果没有,则未安装扩展程序.
  1. Find all PHP versions installed brew list | grep php
  2. Remove all versions of PHP brew remove --ignore-dependencies --force php70 php71 php72 (based on what you see above)
  3. Install PHP brew install php72 (i chose 7.2, 7.3 is not supported yet by several vendors)
  4. Run the command which php should show you the path to the installed PHP. Copy the path.
  5. Update your bash_profile vi ~/.bash_profile and add this line to the file: export PATH=/usr/local/php5/bin:$PATH
  6. Save and run this source ~/.bash_profile
  7. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆