未找到 PHP 删除/修复模块或已加载警告?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19653926/
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 remove/fix module not found or already loaded warnings?
提问by mahen3d
When i run a php script from the command line like below
当我从命令行运行 php 脚本时,如下所示
php test.php
i get following output
我得到以下输出
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
PHP Warning: Module 'apc' already loaded in Unknown on line 0
how do i fix or remove these module warnings ? I checked the php.ini in
我如何修复或删除这些模块警告?我检查了 php.ini
etc/php.ini
output of
输出
php -i | grep php.ini
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
PHP Warning: Module 'apc' already loaded in Unknown on line 0
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
i dont see any loading or any reference to these two modules in there ...
我在那里没有看到任何加载或对这两个模块的任何引用......
please help
请帮忙
回答by Jenson M John
When you install php5-memcache it adds it's own memcache.ini file which is set to load that extension already. So Just remove/comment the loading of the extension from your php.ini.
当您安装 php5-memcache 时,它会添加它自己的 memcache.ini 文件,该文件已设置为加载该扩展程序。所以只需从你的 php.ini 中删除/评论扩展的加载。
;extension=memcache.so
Similar with APC (Alternative PHP Cache Module).
类似于 APC(替代 PHP 缓存模块)。
;extension=apc.so
回答by cristi2091
I had the same situation. In my case the problem was that I had two configuration files for memcache in /etc/php5/cli/conf.d/.
我有同样的情况。就我而言,问题是我在 /etc/php5/cli/conf.d/ 中有两个 memcache 配置文件。
php -i | grep memcache.ini
In my case the result was:
就我而言,结果是:
/etc/php5/cli/conf.d/20-memcache.ini,
/etc/php5/cli/conf.d/memcache.ini
To get rid of the warning message I removed the line extension=memcache.so
from the memcache.ini file.
为了摆脱警告消息,我extension=memcache.so
从 memcache.ini 文件中删除了该行。
回答by John Chornelius
If you are using php5.4 (CentOS 6.5),
如果您使用的是 php5.4 (CentOS 6.5),
- Goto
/etc/php.d/
in
memcache.ini
comment the extension;extension=memcache.so
likewise in
apc.ini
;extension=apc.so
- 去
/etc/php.d/
在
memcache.ini
评论扩展名;extension=memcache.so
同样在
apc.ini
;extension=apc.so
回答by Allan Mwesigwa
I came here looking for a solution to a similar error i.e. Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
.
After looking at various sites, here's the solution I came up with.
It worked for me, hope it does for someone with a similar issue.
我来这里是为了寻找类似错误的解决方案,即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"
。通过在行的开头添加分号来注释掉 ie;extension="/usr/local/opt/php70-pdo-pgsql/pdo_pgsql.so"
。 - 保存文件。(我通常运行control + O,control + M)。
- 退出文件(control + X)。
回答by Hemant Thorat
I was getting same error,
我遇到了同样的错误,
Module 'sphinx' already loaded
You need to find module (.ini) which is getting loaded more than once and delete one of them,
您需要找到多次加载的模块 (.ini) 并删除其中之一,
ubuntu@webserver:~$ grep -R "sphinx" /etc/php5/*
/etc/php5/fpm/conf.d/sphinx.ini:extension=sphinx.so
/etc/php5/fpm/conf.d/20-sphinx.ini:extension=sphinx.so
ubuntu@webserver:~$ sudo rm /etc/php5/fpm/conf.d/sphinx.ini
回答by Турецкий Гамбит
there are configuration files modules /etc/php5/mods-available
有配置文件模块/etc/php5/mods-available
Open file pdo_mysql.ini and commentline pdo_mysql.so
打开文件 pdo_mysql.ini 和注释行pdo_mysql.so
After service apache2 | php5-fpm restartdepending on whether you are using you
后服务的Apache2 | php5-fpm 重启取决于你是否使用你
回答by Shriganesh Shintre
Its possible that these modules are listed twice and so you get error "Already loaded". Find out which configuration files are loaded
这些模块可能被列出两次,因此您会收到错误“已加载”。找出加载了哪些配置文件
php -i | grep 'Loaded Configuration File'
php -i | grep 'ini'
This will tell you which .ini files are loaded and parsed (Additional .ini files parsed).
这将告诉您加载和解析了哪些 .ini 文件(解析了其他 .ini 文件)。
Look at the specific files and comment out the second occurrence (as follows)
查看具体文件,注释掉第二次出现的(如下)
;extension=memcache.so
;extension=apc.so
回答by Abhishek
if you dont whants to update in config file, just add on top of your page or constructor "error_reporting(0)"
如果您不想在配置文件中更新,只需在页面或构造函数的顶部添加“ error_reporting(0)”