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
Rrun the following command:
php -v 
You will see the warnings go away.

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.

4 Responses to “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”

  1. thanks, quick solution!

  2. Thank you so much. I removed the extension in the php.ini and the problem was solved. Thx!

  3. nice thanks for this fix for php cli

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: