When running the CLI version of PHP from the command line, you may receive errors like PHP Warning: Module ‘memcache’ already loaded in Unknown on line 0
When running the CLI version of PHP from the command line, you may receive errors like the following:
[root@myserver /root]$ php -v
PHP Warning: Module ‘memcache’ already loaded in Unknown on line 0
PHP 5.2.3 (cli) (built: Jun 14 2007 15:29:17)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Cause
There are two ways to load most extensions in PHP. One is by compiling the extension directly into the PHP binary. The other is by loading a shared extension dynamically via an ini file. The errors indicate that dynamic extensions are being loaded via .ini files, even though they are already compiled into the PHP binary.
Fix:
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:
extension=memcache.so
You may also erase this line instead of commenting them out. Once you have disabled those lines save the file and restart apache.
>>/etc/init.d/httpd restart
Run php -v to see if the warnings go away.
OR
You may also remove it from special configuration file which creates while installation:
vi /etc/php.d/memcache.ini
/etc/php.d/memcache.ini
Configuration file contents
extension=memcache.so
You may also erase this line instead of commenting them out. Save the file and restart apache.
>>/etc/init.d/httpd restart
Run the following command:
php -v
You will see the warnings go away.
August 24, 2009 at 9:00 pm
thanks, quick solution!
March 10, 2010 at 11:01 pm
Thank you so much. I removed the extension in the php.ini and the problem was solved. Thx!
June 7, 2011 at 12:11 am
nice thanks for this fix for php cli
December 16, 2011 at 4:03 pm
Thanks.