简体   繁体   English

macOS Sierra安装PHP扩展intl

[英]macOS Sierra installing PHP Extension intl

I am trying to get magento 2.x to run on my machine. 我想让magento 2.x在我的机器上运行。 I am using xampp 5.6 with the same php version and running a virtual apache server. 我使用xampp 5.6与相同的PHP版本和运行虚拟Apache服务器。

As seen in this screenshot 如截图所示 在此输入图像描述 The PHP Extension intl. PHP扩展intl。 is missing. 不见了。

I was researching on how it can be added / activated. 我正在研究如何添加/激活它。

I tried uncommenting the extension in the php.ini of xampp but it still appears as missing. 我尝试取消注释xampp的php.ini中的扩展名,但它仍然显示为缺失。

I tried to follow this guide , but when I try to install intl with 我尝试按照本指南 ,但当我尝试安装intl时

sudo pecl install intl

it fails with 它失败了

2 warnings and 1 error generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed

You have to provide the intl.so file which doesn't come with XAMPP. 您必须提供不带XAMPP的intl.so文件。

To fix this you just have to follow the steps below. 要解决此问题,您只需按照以下步骤操作即可。

  1. Get the intl.so file (explained below) 获取intl.so文件(如下所述)
  2. Copy the intl.so file to /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-[some date]/ 将intl.so文件复制到/ Applications / XAMPP / xamppfiles / lib / php / extensions / no-debug-non-zts- [some date] /
  3. Add a new line extension=intl.so to the end of your php.ini which is usually located at /Applications/XAMPP/xamppfiles/etc/php.ini 在php.ini的末尾添加一个新行extension=intl.so ,它通常位于/Applications/XAMPP/xamppfiles/etc/php.ini
  4. Restart Apache Server 重启Apache服务器

Only the first step is different for different users. 对于不同的用户,只有第一步是不同的。

You have to get the correct intl.so file. 您必须获取正确的intl.so文件。

if you have php 7.0 run brew install php70-intl other versions must be php71-intl or php56-intl . 如果你有php 7.0运行brew install php70-intl其他版本必须是php71-intlphp56-intl

Your intl.so can be found in /usr/local/Cellar/php70-intl/[version]/intl.so 您的intl.so可以在/usr/local/Cellar/php70-intl/[version]/intl.so找到

It should be similar for different php versions. 对于不同的php版本应该是类似的。

To copy it : open your terminal 复制它:打开你的终端

cd /usr/local/Cellar/php70-intl/[version]/
cp intl.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-[some date]/

Now add your entry to the php ini file and restart Apache. 现在将您的条目添加到php ini文件并重新启动Apache。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM