XAMPP 上的 PHP-intl 安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27886117/
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
Php-intl installation on XAMPP
提问by Alessandro Minoccheri
I need to use the extension intl on my mac with XAMPP.
我需要在我的 mac 上使用 XAMPP 的扩展名 intl。
So I have followed this links:
所以我遵循了这个链接:
Php-intl installation on XAMPP for Mac Lion 10.8
XAMPP for Mac Lion 10.8 上的 PHP-intl 安装
http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html
http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html
I restart always my apache server but isn't installed the extension. Because if I launch:
我总是重新启动我的 apache 服务器,但没有安装扩展。因为如果我启动:
php -m | grep intl #should return 'intl'
return empty
返回空
The command that I can't launch without it is for composer and cakephp like this:
没有它我无法启动的命令是用于 composer 和 cakephp 的,如下所示:
composer create-project --prefer-dist -s dev cakephp/app cakephp3
Return me this error:
返回给我这个错误:
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
Problem 2
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/bake dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].
So I need to solve the problem of ext-intl with the extension intl.
所以我需要用扩展intl来解决ext-intl的问题。
Can someone help me with this problem? How can I install this extension?
有人可以帮我解决这个问题吗?如何安装此扩展程序?
Thanks
谢谢
回答by Kunal Panchal
These below steps helped me, 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 的步骤
Check which php path is set i.e.
root$: which php
If you are using xampp on your mac it should be
/Applications/XAMPP/xamppfiles/bin/php
but if its
/usr/bin/php
you need to change your OSx php
root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
Install icu4c
root$: brew install icu4c
Install Intl via PECL
root$: sudo pecl update-channels root$: sudo pecl install intl
You can check if Intl was installed successfully
root$: php -m | grep intl #should return 'intl'
检查设置了哪个 php 路径,即
root$: which php
如果您在 Mac 上使用 xampp,它应该是
/Applications/XAMPP/xamppfiles/bin/php
但如果它
/usr/bin/php
你需要改变你的 OSx php
root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
安装icu4c
root$: brew install icu4c
通过 PECL 安装 Intl
root$: sudo pecl update-channels root$: sudo pecl install intl
您可以检查 Intl 是否安装成功
root$: php -m | grep intl #should return 'intl'
Done
完毕
============================
============================
Note:
笔记:
From extensions list in
/Applications/XAMPP/xamppfiles/etc/php.ini
file Add / Uncommentextension=intl.so
line. And restart Apache. Thanks @pazhynBefore installing "intl" you have to install Autoconf if you have not installed it. Thanks @Digant
- via Homebrewbrew install autoconf automake or
by running below commands
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz tar xzf autoconf-latest.tar.gz cd autoconf-* ./configure --prefix=/usr/local make sudo make install cd .. rm -r autoconf-*
从
/Applications/XAMPP/xamppfiles/etc/php.ini
文件中的扩展列表添加/取消注释extension=intl.so
行。并重新启动Apache。谢谢@pazhyn在安装“intl”之前,如果你还没有安装 Autoconf,你必须先安装它。谢谢@Digant
- 通过Homebrewbrew install autoconf automake 或
通过运行以下命令
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz tar xzf autoconf-latest.tar.gz cd autoconf-* ./configure --prefix=/usr/local make sudo make install cd .. rm -r autoconf-*
回答by jhaavist
I had issues with intl when using Moodle, which I fixed by doing the following:
我在使用 Moodle 时遇到了 intl 问题,我通过执行以下操作解决了这个问题:
- Re-run the XAMPP installer (if you don't have the installer on hand, download it from here) and tick the "XAMPP Developer Files"
- Use your terminal and go into XAMPP's binary folder
$ cd /Applications/XAMPP/bin
Use PHP's package manager to install
intl
by running$ sudo ./pecl install intl
This should compile some things, and if successful, the installation should complete with:Build process completed successfully Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so' install ok: channel://pecl.php.net/intl-3.0.0 configuration option "php_ini" is not set to php.ini location You should add "extension=intl.so" to php.ini
$ cd ../etc
There you will have yourphp.ini
to which you have to addextension=intl.so
On my system I appended the line after line 959, which you can find by searching forphp_intl
- Finally restart your Apache web server from the XAMPP GUI.
- 重新运行 XAMPP 安装程序(如果您手头没有安装程序,请从此处下载)并勾选“XAMPP 开发人员文件”
- 使用您的终端并进入 XAMPP 的二进制文件夹
$ cd /Applications/XAMPP/bin
使用 PHP 的包管理器
intl
通过运行安装$ sudo ./pecl install intl
这应该编译一些东西,如果成功,安装应该完成:Build process completed successfully Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so' install ok: channel://pecl.php.net/intl-3.0.0 configuration option "php_ini" is not set to php.ini location You should add "extension=intl.so" to php.ini
$ cd ../etc
在那里,您将拥有您php.ini
必须添加的内容extension=intl.so
在我的系统上,我在第 959 行之后添加了该行,您可以通过搜索找到php_intl
- 最后从 XAMPP GUI 重新启动 Apache Web 服务器。
Hope this works for you!
希望这对你有用!
回答by Leandro Souza Araujo
I had the same problem with XAMPP. I tried several answers but without success. Could solve lowering an alternative library http://php-osx.liip.ch/. This library php, comes already installed intl and several other package. After downloading went to httpd.conf in xampp and LoadModule php5_module pointed to these packages in /usr/local/php5/libphp5.so
我在 XAMPP 上遇到了同样的问题。我尝试了几个答案,但没有成功。可以解决降低替代库http://php-osx.liip.ch/ 的问题。这个库 php,已经安装了 intl 和其他几个包。下载后进入 xampp 中的 httpd.conf 并且 LoadModule php5_module 指向 /usr/local/php5/libphp5.so 中的这些包