php 作曲家 - 缺少扩展 iconv

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25122037/
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 17:40:09  来源:igfitidea点击:

Composer - extension iconv is missing

phpapachecomposer-phpiconvnette

提问by Tanadche

I'm running Manjaro linux and I have installed apache 2.4.10-1 with php 5.5.15-1 and php-composer 1.0.0.alpha8.458-1.

我正在运行 Manjaro linux,我已经安装了 apache 2.4.10-1 和 php 5.5.15-1 和 php-composer 1.0.0.alpha8.458-1。

I want to download project with composer by this command

我想通过这个命令用 composer 下载项目

composer create-project nette/sandbox TaskManager

but I'm getting error with ext-iconv

但我在使用 ext-iconv 时遇到错误

- nette/neon v2.2.1 requires ext-iconv * -> the requested PHP extension iconv is missing from your system.
- nette/nette v2.2.0 requires ext-iconv * -> the requested PHP extension iconv is missing from your system.

But in my php.ini i have enabled iconv extension

但是在我的 php.ini 中我启用了 iconv 扩展

extension=iconv.so
.
.
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encoding = ISO-8859-1
iconv.output_encoding = ISO-8859-1

In my php scripts I can use iconv function without any problem.

在我的 php 脚本中,我可以毫无问题地使用 iconv 函数。

When I run php -m i see iconv in list with other modules

当我运行 php -mi 时,在列表中看到 iconv 与其他模块

Any idea where could be problem?

知道哪里可能有问题吗?

Edit: When I run php -i from cli, I got this:

编辑:当我从 cli 运行 php -i 时,我得到了这个:

Configuration File (php.ini) Path => /etc/php
Loaded Configuration File => /etc/php/php.ini
Scan this dir for additional .ini files => /etc/php/conf.d
Additional .ini files parsed => (none)

And in this config file is iconv enabled.

在这个配置文件中启用了 iconv。

Even when I run

即使我跑

php -d error_reporting=E_ALL -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "?lu?ou?ky k?ň\n");'

it executes properly and prints "Zlutoucky kun".

它正确执行并打印“Zlutoucky kun”。

回答by Tanadche

So i found out, that composer uses different php config file, which is stored in

所以我发现,那个作曲家使用不同的 php 配置文件,它存储在

/usr/share/php-composer/php.ini

there I just added following line

在那里我刚刚添加了以下行

extension=iconv.so

And everything works!

一切正常!

回答by darioxlz

I solved this problem uncomment the line

我解决了这个问题取消注释该行

ext=iconv

in /etc/php/ini.php Working on manjaro linux

在 /etc/php/ini.php 工作在 manjaro linux

回答by Ahmet U?ur

In WHM on Centos7 it worked for me.

在 Centos7 上的 WHM 中,它对我有用。

yum install ea-php72-php-iconv

You can replace your php version instead of php72

您可以替换您的 php 版本而不是php72

回答by yesnik

If you are using PHPBrewrun this command to install iconvextension:

如果您使用PHPBrew,请运行此命令来安装iconv扩展:

phpbrew ext install iconv