[英]Php-intl installation on XAMPP
我需要在我的 mac 上使用 XAMPP 的扩展名 intl。
所以我遵循了这个链接:
XAMPP for Mac Lion 10.8 上的 PHP-intl 安装
http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html
我总是重新启动我的 apache 服务器,但没有安装扩展。 因为如果我启动:
php -m | grep intl #should return 'intl'
返回空
没有它我无法启动的命令是用于 composer 和 cakephp 的,如下所示:
composer create-project --prefer-dist -s dev cakephp/app cakephp3
返回给我这个错误:
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].
所以我需要用扩展intl来解决ext-intl的问题。
有人可以帮我解决这个问题吗? 如何安装此扩展程序?
谢谢
以下这些步骤对我有帮助,以防万一您使用的是 OSX
来自http://www.phpzce.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp 的步骤
检查设置了哪个 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'
完毕
============================
笔记:
从/Applications/XAMPP/xamppfiles/etc/php.ini
文件中的扩展列表添加/取消注释extension=intl.so
行。 并重新启动Apache。 谢谢@pazhyn
在安装“intl”之前,如果你还没有安装 Autoconf,你必须先安装它。 谢谢@Digant
通过运行以下命令
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-*
我在使用 Moodle 时遇到了 intl 问题,我通过执行以下操作解决了这个问题:
$ 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 上遇到了同样的问题。 我尝试了几个答案,但没有成功。 可以解决降低替代库http://php-osx.liip.ch/ 的问题。 这个库 php,已经安装了 intl 和其他几个包。 下载后进入 xampp 中的 httpd.conf 并且 LoadModule php5_module 指向 /usr/local/php5/libphp5.so 中的这些包
上述解决方案在我运行后不适用于 PHP 7.4
sudo pecl install intl
然后我收到这个错误:
n file included from
fatal error: 'php.h' file not found
#include <php.h>
^~~~~~~
1 error generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.