PHP 警告:模块已在第 0 行的 Unknown 中加载
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32764981/
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 Warning: Module already loaded in Unknown on line 0
提问by Drew Landgrave
On Mac OSX Mavericks using homebrew php55 whenever I run a a php command I get the following error message (everything runs fine it's just annoying)
在 Mac OSX Mavericks 上使用 homebrew php55 每当我运行 aa php 命令时,我都会收到以下错误消息(一切正常,只是很烦人)
PHP Warning: Module 'intl' already loaded in Unknown on line 0
I ran
我跑了
php --ini
and the output was
输出是
php --ini
PHP Warning: Module 'intl' already loaded in Unknown on line 0
Warning: Module 'intl' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/5.5
Loaded Configuration File: /usr/local/etc/php/5.5/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.5/conf.d
Additional .ini files parsed: /usr/local/etc/php/5.5/conf.d/ext-apcu.ini,
/usr/local/etc/php/5.5/conf.d/ext-igbinary.ini,
/usr/local/etc/php/5.5/conf.d/ext-intl.ini,
/usr/local/etc/php/5.5/conf.d/ext-memcached.ini,
/usr/local/etc/php/5.5/conf.d/ext-mongo.ini,
/usr/local/etc/php/5.5/conf.d/ext-uuid.ini,
/usr/local/etc/php/5.5/conf.d/ext-xdebug.ini
Checked in the php.ini file and the only place intl is loaded is at the top and it's commented out. The other files contents look something like:
检查 php.ini 文件,唯一加载 intl 的地方是在顶部,它被注释掉了。其他文件内容类似于:
extension="/usr/local/Cellar/php55/5.5.23/lib/php/extensions/no-debug-non-zts-20121212/intl.so"
where the contents after the last slash is the extension.
其中最后一个斜杠后的内容是扩展名。
I'm not sure where else to look.
我不知道还能在哪里看。
Any help is appreciated
任何帮助表示赞赏
采纳答案by bueltge
I think you have loaded Xdebugprobably twice in php.ini
.
check the
php.ini
, that not have setxdebug.so
for the valuesextension=
andzend_extension=
.Check also
/etc/php5/apache2
and/etc/php5/cli/
. You should not load in eachphp.ini
in these directories the extensionxdebug.so
. Only one filephp.ini
should load it.Note: Inside the path is the string
/etc/php5
. The 5 is the version of PHP. So if you use another version you get always a different path, likephp7
.
检查
php.ini
,未设置xdebug.so
值extension=
和zend_extension=
。也检查
/etc/php5/apache2
和/etc/php5/cli/
。您不应php.ini
在这些目录中的每个目录中加载扩展名xdebug.so
. 只有一个文件php.ini
应该加载它。注意:路径里面是字符串
/etc/php5
。5是PHP的版本。因此,如果您使用其他版本,您总是会得到不同的路径,例如php7
.
回答by Allan Mwesigwa
I had the same issue on mac i.e. Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
.
Here's how I solved it.
我在 mac ie 上遇到了同样的问题Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
。这是我解决它的方法。
- Locate the folder
conf.d
, mine was in the directory/usr/local/etc/php/7.0/conf.d
. - In this folder, there's a filecalled
ext-pdo_pgsql.ini
. - Type
sudo nano ext-pdo_pgsql.ini
to edit it. - There should be a line
extension="/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so"
. Comment it out by adding semi-colon to the beginning of the line i.e.;extension="/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so"
. - Save the file. (I usually run control + O, control + M).
- Exit the file (control + X).
- 找到文件夹
conf.d
,我的在目录中/usr/local/etc/php/7.0/conf.d
。 - 在此文件夹中,有一个文件叫
ext-pdo_pgsql.ini
。 - 键入
sudo nano ext-pdo_pgsql.ini
以对其进行编辑。 - 应该有一条线
extension="/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so"
。通过在行的开头添加分号来注释掉,即;extension="/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so"
。 - 保存文件。(我通常运行control + O,control + M)。
- 退出文件(control + X)。
Hope this helps someone.
希望这可以帮助某人。
回答by J.C. Gras
To fix this problem, you must edit your php.ini (or extensions.ini) file and comment-out the extensions that are already compiled-in. For example, after editing, your ini file may look like the lines below:
要解决此问题,您必须编辑 php.ini(或 extensions.ini)文件并注释掉已编译的扩展。例如,编辑后,您的 ini 文件可能如下所示:
;extension=pcre.so
;extension=spl.so
Source: http://www.somacon.com/p520.php
回答by Matthew Marichiba
You should have a /etc/php2/conf.ddirectory (At least on Ubuntu I do) containing a bunch of .ini files which all get loaded when php runs. These files can contain duplicate settings that conflict with settings in php.ini
. In my PHP installation I notice a file conf.d/20-intl.ini
with an extension=intl.so
setting. I bet that's your conflict.
您应该有一个/etc/php2/conf.d目录(至少在我的 Ubuntu 上是这样),其中包含一堆 .ini 文件,这些文件在 php 运行时都会被加载。这些文件可能包含与 中的设置冲突的重复设置php.ini
。在我的 PHP 安装中,我注意到一个conf.d/20-intl.ini
带有extension=intl.so
设置的文件。我敢打赌那是你的冲突。
回答by Marcelo Agimóvel
In my case I had uncoment the ;extension=php_curl.so in php.ini, but Ubuntu was already calling this extension somewhere else.
就我而言,我在 php.ini 中取消了 ;extension=php_curl.so 的注释,但 Ubuntu 已经在其他地方调用了这个扩展。
To find this "somewhere else", on php.ini will informe. On my case: /etc/php/7.1/apache2/conf.d/20-curl.ini was the path.
要找到这个“其他地方”,在 php.ini 上会通知。就我而言: /etc/php/7.1/apache2/conf.d/20-curl.ini 是路径。
So now we edit this file (terminal):
所以现在我们编辑这个文件(终端):
sudo nano /etc/php/7.1/apache2/conf.d/20-curl.ini
Comment the ;extension=php_curl.so
注释 ;extension=php_curl.so
Save file and restart apache:
保存文件并重启apache:
sudo systemctl restart apache2
回答by Ilia Rostovtsev
I had the same issue after upgrading from Fedora Server 24 (PHP 5)to 25(PHP 7). After investigation, I found that /etc/php.d/
had two different .ini
files loading extension=geoip.so
.
从Fedora Server 24 (PHP 5)升级到 25 (PHP 7)后,我遇到了同样的问题。经过调查,我发现/etc/php.d/
有两个不同的.ini
文件加载extension=geoip.so
。
Previous version of distros had this file named 50-geoip.ini
but the recent was changed to 40-geoip.ini
, and I suspect that in the version-upgrade process the old hasn't been removed, while the new one has been created.
以前版本的发行版有这个文件名,50-geoip.ini
但最近40-geoip.ini
的版本改为,我怀疑在版本升级过程中旧的没有被删除,而新的已经创建。
That was the actual case of the issue. After removing stray 50-geoip.ini
from /etc/php.d/
and restarting httpd
it just worked flawlessly.
这就是问题的实际情况。除去杂散后50-geoip.ini
从/etc/php.d/
并重新启动httpd
它只是工作得十分完美。
回答by Laith
I deleted the 20-mongo.ini file in /etc/php5/cli/conf.d and this solved the problem.
我删除了 /etc/php5/cli/conf.d 中的 20-mongo.ini 文件,这解决了问题。
回答by ashik
There are two "php_intl.dll" files inside php.ini file on 872 and 968 number lines. if php warning module 'intl' already loaded in unknown on line 0this message is focused on your CLI. Then you should have to remove the semiclone prefixes on line 872. I expect this will done.....
在 872 和 968 数字线上的 php.ini 文件中有两个“php_intl.dll”文件。如果php 警告模块 'intl' 已经在第 0 行的 unknown 中加载,则此消息将集中在您的 CLI 上。然后你应该删除第 872 行的半克隆前缀。我希望这会完成......
回答by sanka
Just for the record as it might help others who are on shared hosting (cPanel).
仅供记录,因为它可能会帮助使用共享主机 (cPanel) 的其他人。
I had error on shared hosting php7.2: Module 'imagick' already loaded in Unknown on line 0
我在共享主机 php7.2 上出错:模块“imagick”已经加载在第 0 行的未知中
In the beginning hosting provider said it was my bad configuration (running Yii2.16). But after I showed them, that all Internet related this issue to server configuration -they started to listen to me. After I proved, that there was no error on php7.1 they started to search for the error.
一开始托管服务提供商说这是我的错误配置(运行 Yii2.16)。但是在我向他们展示之后,所有互联网都将这个问题与服务器配置相关——他们开始听我的。在我证明php7.1上没有错误后,他们开始搜索错误。
As they told to me - the error was due to configuration in PERL modules or PEAR package, but they did not told me the real issue.
正如他们告诉我的那样 - 错误是由于 PERL 模块或 PEAR 包中的配置造成的,但他们没有告诉我真正的问题。
So, if you are on shared hosting - talk to you provider and experiment with PHP versions (if you can change them).
因此,如果您使用共享主机 - 与您的提供商联系并尝试使用 PHP 版本(如果您可以更改它们)。
回答by Pratik
Comment out these two lines in php.ini
注释掉这两行 php.ini
;extension=imagick.so
;extension="ixed.5.6.lin"
it should fix the issue.
它应该解决这个问题。