intl PHP 扩展不适用于 xampp 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30480678/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 21:48:58  来源:igfitidea点击:

intl PHP extension is not working for xampp server

phpcakephp

提问by Mash

I am trying to install CakePHP 3-0-0version and I have downloaded the source code from here. But it is showing the error of enable intl extension. As I have already changed ;extension=php_intl.dllto extension=php_intl.dll(remove the semicolon) in php.inifile and restart xampp 2-3times, but still it is showing that same error.

我正在尝试安装CakePHP 3-0-0版本,我已经从这里下载了源代码。但它显示了 enable 的错误intl extension。因为我已经在文件中更改;extension=php_intl.dllextension=php_intl.dll(删除分号)php.ini并重新启动 xampp2-3次,但它仍然显示相同的错误。

Here is the error below:

这是下面的错误:

Fatal error: You must enable the intl extension to use CakePHP. in D:\xampp\htdocs\cakephp-3-0-0\config\bootstrap.php on line 38

So, can anyone please tell me what is the issue here? And what should I do to resolved this issue?

那么,谁能告诉我这里的问题是什么?我应该怎么做才能解决这个问题?

回答by RiggsFolly

Once you have activated the php_intl.dllin the php.ini file you also need to copy the dll files that php_intl.dlluses from the PHP folder to the Apache/bin folder.

一旦您php_intl.dll在 php.ini 文件中激活了,您还需要将使用的 dll 文件php_intl.dll从 PHP 文件夹复制到 Apache/bin 文件夹。

I am not a XAMPP user so I am not sure of the actual folder names

我不是 XAMPP 用户,所以我不确定实际的文件夹名称

copy xampp/php/icu*.dll to xamp\apache\bin

将 xampp/php/icu*.dll 复制到 xamp\apache\bin

Also remember that you have to edit the php.ini file that lives in the \xampp\apache\binfolder and not the one in the \xampp\phpfolder.

还要记住,您必须编辑位于文件\xampp\apache\bin夹中的 php.ini 文件,而不是\xampp\php文件夹中的文件。

The one in the \xampp\phpfolder only gets used by PHP CLI (Command Line Interface)

\xampp\php文件夹中的一个只被 PHP CLI(命令行界面)使用

回答by kaligari

In my case problem was to restart Apache process. Restart in XAMPP control panel by clicking Stop and Start is not enough. I had to run Task Manager and kill httpd.exe process. Then run XAMPP again. That solve problem.

就我而言,问题是重新启动 Apache 进程。通过单击停止和启动在 XAMPP 控制面板中重新启动是不够的。我不得不运行任务管理器并杀死 httpd.exe 进程。然后再次运行 XAMPP。那解决问题。

回答by Kunal Panchal

Just in case if you are using OSX

以防万一,如果您使用的是 OSX

Steps from http://www.phpzce.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp

来自http://www.phpzce.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp 的步骤

  1. Check which php path is set i.e.

    root$: which php

  2. If you are using xampp on your mac it should be

    /Applications/XAMPP/xamppfiles/bin/php

  1. 检查设置了哪个 php 路径,即

    root$: 哪个 php

  2. 如果您在 Mac 上使用 xampp,它应该是

    /应用程序/XAMPP/xamppfiles/bin/php

but if its

但如果它

/usr/bin/php 

you need to change your OSx php

你需要改变你的 OSx php

root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}" 
  1. Install icu4c

    root$: brew install icu4c

  2. Install Intl via PECL

    root$: sudo pecl update-channels root$: sudo pecl install intl

  3. You can check if Intl was installed successfully

    root$: php -m | grep intl #should return 'intl'

  1. 安装icu4c

    root$: brew install icu4c

  2. 通过 PECL 安装 Intl

    root$:sudo pecl 更新通道 root$:sudo pecl install intl

  3. 您可以检查 Intl 是否安装成功

    root$: php -m | grep intl #应该返回'intl'

Done

完毕

回答by Repeat Spacer

For me (not using any xampp, just Apache 2.4 and php 5.5. installed on Windows 7):

对我来说(不使用任何 xampp,只使用 Apache 2.4 和 php 5.5。安装在 Windows 7 上):

After uncommenting the intl-extension in php.ini, it didn't come active cause I only RESTARTED Apache server!

在 php.ini 中取消注释 intl-extension 后,它没有激活,因为我只重新启动了 Apache 服务器!

This is best to observe from phpinfo() page (try to find intl).

这最好从 phpinfo() 页面观察(尝试查找 intl)。

So I think the problem was solved when I stop and start the Apache server. (Probably same problem as in kaligari answer)

所以我认为当我停止并启动Apache服务器时问题就解决了。(可能与kaligari 答案中的问题相同)

While trying solutions I moved the php folder and changed the folder to Apache conf file BUT forgot to change the environmental variable path to php, so after while I found this and got it work.

在尝试解决方案时,我移动了 php 文件夹并将文件夹更改为 Apache conf 文件,但忘记将环境变量路径更改为 php,所以在我找到它并使其工作之后。

Control Panel->System->Advanced->Environmental variables->Path->Check php folder is there Thanks to Gregory Karpinsky

Control Panel->System->Advanced->Environmental variables->Path->Check php folder is there感谢 Gregory Karpinsky

SO CHECK THAT IF EXTENSION IS STILL NOT LOADING!

所以请检查扩展是否仍然没有加载!

No need to copy any files from php->apache\bin. This is probably because I'm not using xampp BUT it is necessery to actually STOP and START over the Apache service to get it to reload the php extensions and have the path environmental variable correct.

无需从 php->apache\bin 复制任何文件。这可能是因为我没有使用 xampp 但实际上有必要通过 Apache 服务停止和启动以使其重新加载 php 扩展并正确设置路径环境变量。

回答by Aamir

If you have configured basic settings, try to restart xampp...It worked for me.

如果您已配置基本设置,请尝试重新启动 xampp...它对我有用。