“内存缓存”命令行PHP脚本未找到 [英] 'Memcache' not found in command line PHP script
问题描述
我的Memcache安装和PHP应用程序的工作通过Apache(V2.2)上运行,但是当我尝试运行在命令行一个PHP文件我得到这个错误:
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
94号线是:
$memcache = new Memcache;
其他信息:
CentOS的5.2
PHP 5.2.5(CLI)(建:2008年2月20日21时13分12秒)
Zend引擎V2.2.0,版权所有(C)1998-2007 Zend技术
阿帕奇v2.2.8
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
推荐答案
presumably你必须设定Apache和命令行(CLI)单独的php.ini文件。
Presumably you have separate php.ini files set up for apache and the command line (cli).
如果是这样,你需要将以下添加到您的CLI php.ini文件:
If so, you need to add the following to your cli php.ini file:
extension=memcache.so
在Ubuntu的它在/etc/php5/cli/php.ini
On Ubuntu it's in /etc/php5/cli/php.ini
如果它的工作,然后,如果你在命令行中运行 PHP -m
内存缓存应该出现在模块的列表中。
If it's working then memcache should appear in the list of modules if you run php -m
on the command line.
另外,你可以创建一个文件 /etc/php5/cond.d/memcache.ini
具有相同的内容。
Alternatively, you can create a file /etc/php5/cond.d/memcache.ini
with the same contents.
这篇关于“内存缓存”命令行PHP脚本未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!