PHP remove/fix module not found or already loaded

2019-01-23 23:50发布

When i run a php script from the command line like below

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

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

标签: php php-ini
8条回答
乱世女痞
2楼-- · 2019-01-24 00:12

if you dont whants to update in config file, just add on top of your page or constructor "error_reporting(0)"

查看更多
闹够了就滚
3楼-- · 2019-01-24 00:14

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.

 ;extension=memcache.so

Similar with APC (Alternative PHP Cache Module).

 ;extension=apc.so
查看更多
霸刀☆藐视天下
4楼-- · 2019-01-24 00:14

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/.

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.

查看更多
Melony?
5楼-- · 2019-01-24 00:14

If you are using 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
    
查看更多
一纸荒年 Trace。
6楼-- · 2019-01-24 00:14

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.

  • Locate the folder conf.d, mine was in the directory /usr/local/etc/php/7.0/conf.d.
  • In this folder, there's a file called 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).
查看更多
姐就是有狂的资本
7楼-- · 2019-01-24 00:22

there are configuration files modules /etc/php5/mods-available

Open file pdo_mysql.ini and comment line pdo_mysql.so

After service apache2 | php5-fpm restart depending on whether you are using you

查看更多
登录 后发表回答