Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have Memcache installed and working for PHP apps run through Apache (v2.2) but when I try to run a .php file in the command-line i get this error:

Fatal error: Class 'Memcache' not found in /usr/local/Matters/app/matters-common/connection.php on line 94

Line 94 is:

$memcache = new Memcache;

Other info:

CentOS 5.2
PHP 5.2.5 (cli) (built: Feb 20 2008 21:13:12)
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Apache v2.2.8

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
754 views
Welcome To Ask or Share your Answers For Others

1 Answer

Presumably you have separate php.ini files set up for apache and the command line (cli).

If so, you need to add the following to your cli php.ini file:

extension=memcache.so

On Ubuntu it's in /etc/php5/cli/php.ini

If it's working then memcache should appear in the list of modules if you run php -m on the command line.

Alternatively, you can create a file /etc/php5/cond.d/memcache.ini with the same contents.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...