简体   繁体   English

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

[英]intl PHP extension is not working for xampp server

I am trying to install CakePHP 3-0-0 version and I have downloaded the source code from here . 我正在尝试安装CakePHP 3-0-0版本,我从这里下载了源代码。 But it is showing the error of enable intl extension . 但它显示了启用intl extension的错误。 As I have already changed ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon) in php.ini file and restart xampp 2-3 times, but still it is showing that same error. 因为我已经改变了;extension=php_intl.dllextension=php_intl.dll (删除分号)在php.ini文件中并重新启动xampp 2-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? 我该怎么做才能解决这个问题?

Once you have activated the php_intl.dll in the php.ini file you also need to copy the dll files that php_intl.dll uses from the PHP folder to the Apache/bin folder. 一旦你在php.ini文件中激活了php_intl.dll ,你还需要将php_intl.dll使用的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\\bin folder and not the one in the \\xampp\\php folder. 还要记住,你必须编辑位于\\xampp\\apache\\bin文件夹中的php.ini文件,而不是编辑\\xampp\\php文件夹中的文件。

The one in the \\xampp\\php folder only gets used by PHP CLI (Command Line Interface) \\xampp\\php文件夹中的一个仅供PHP CLI使用(命令行界面)

In my case problem was to restart Apache process. 在我的情况下问题是重新启动Apache进程。 Restart in XAMPP control panel by clicking Stop and Start is not enough. 单击“停止”,“启动”不足,重新启动XAMPP控制面板。 I had to run Task Manager and kill httpd.exe process. 我不得不运行任务管理器并杀死httpd.exe进程。 Then run XAMPP again. 然后再次运行XAMPP。 That solve problem. 那解决了问题。

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 ie 检查哪个php路径设置即

    root$: which php root $:哪个php

  2. If you are using xampp on your mac it should be 如果您在Mac上使用xampp它应该是

    /Applications/XAMPP/xamppfiles/bin/php /应用/ XAMPP / xamppfiles /斌/ 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 安装icu4c

    root$: brew install icu4c root $:brew install icu4c

  2. Install Intl via PECL 通过PECL安装Intl

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

  3. You can check if Intl was installed successfully 您可以检查Intl是否已成功安装

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

Done 完成

For me (not using any xampp, just Apache 2.4 and php 5.5. installed on Windows 7): 对我来说(不使用任何xampp,只需在Windows 7上安装Apache 2.4和php 5.5):

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. 所以我认为当我停止并启动Apache服务器时,问题就解决了。 (Probably same problem as in kaligari answer ) (可能与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 控制面板 - >系统 - >高级 - >环境变量 - >路径 - >检查php文件夹是否有感谢Gregory Karpinsky

SO CHECK THAT IF EXTENSION IS STILL NOT LOADING! 检查如果扩展仍然没有加载!

No need to copy any files from php->apache\\bin. 无需从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. 这可能是因为我没有使用xampp但是实际上停止和启动Apache服务以使其重新加载php扩展并使路径环境变量正确是必要的。

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

In both XAMPP and WAMP, mcrypt and mbstring extensions are working by default. 在XAMPP和WAMP中,mcrypt和mbstring扩展默认工作。

In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel. 在XAMPP中,包含了intl扩展,但您必须在php.ini中取消注释extension = php_intl.dll并通过XAMPP控制面板重新启动服务器。

In WAMP, the intl extension is “activated” by default but not working. 在WAMP中,intl扩展默认为“激活”但不起作用。 To make it work you have to go to php folder (by default) C:\\wamp\\bin\\php\\php{version}, copy all the files that looks like icu*.dll and paste them into the apache bin directory C:\\wamp\\bin\\apache\\apache{version}\\bin. 要使它工作,你必须转到php文件夹(默认情况下)C:\\ wamp \\ bin \\ php \\ php {version},复制所有看起来像icu * .dll的文件并将它们粘贴到apache bin目录C: \\ WAMP \\ BIN \\ apache的\\ apache的{}版本\\ BIN。 Then restart all services and it should be OK. 然后重新启动所有服务,它应该没问题。

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

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