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条回答
forever°为你锁心
2楼-- · 2019-01-24 00:32

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,

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
查看更多
太酷不给撩
3楼-- · 2019-01-24 00:37

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

Look at the specific files and comment out the second occurrence (as follows)

;extension=memcache.so
;extension=apc.so
查看更多
登录 后发表回答