PHP memcached致命错误:没有找到“Memcache”类

时间:2022-03-23 08:01:42

I've pasted the example from php.net for using memcached in php and I'm getting:

我粘贴了php。net中使用memcached的例子,我得到:

Fatal error: Class 'Memcache' not found

I have this in my php.ini:

我在php.ini:

[memcache]
memcache.hash_strategy = "consistent"
memcache.max_failover_attemps = 100
memcache.allow_failover = 1

memcache memcache。hash_strategy = "一致" memcache。max_failover_attemps = 100 memcache。allow_failover = 1

Here's info from php -i and php -m respectively:

这里分别是php -i和php -m的信息:

php -i | grep -i memcache
memcached
memcached support => enabled
libmemcached version => 0.37
Registered save handlers => files user sqlite memcached

php -i | grep -i memmemmemcache缓存支持=>启用libmemcached version => 0.37注册保存处理程序=> file用户sqlite memcached缓存

php -m | grep -i memcache
memcached

php -m | grep -i memcache memcached。

So php seems to have loaded memcached as a module, and php info says that it is loaded and is using v .37. I have not tried yet via apache, I've only been using this through cli right now. Any thoughts?

php似乎已经将memcached作为一个模块加载,php info表示已经加载并使用v .37。我还没有通过apache尝试过,我现在只是通过cli使用它。任何想法吗?

5 个解决方案

#1


113  

There are two extensions for memcached in PHP, "memcache" and "memcached".

在PHP中,memcached有两个扩展,“memcache”和“memcached”。

It looks like you're trying to use one ("memcache"), but the other is installed ("memcached").

看起来您正在尝试使用一个(“memcache”),但是另一个已经安装(“memcached”)。

#2


19  

Dispite what the accepted answer says in the comments, the correct way to install 'Memcache' is:

抛开评论中公认的答案,安装“Memcache”的正确方法是:

sudo apt-get install php5-memcache

#3


1  

I found solution in this post: https://*.com/questions/11883378/class-memcache-not-found-php#=

我在这篇文章中找到了解决方案:https://*.com/questions/11883378/class-memcache- notfound -php#=。

I found the working dll files for PHP 5.4.4

我找到了PHP 5.4.4的工作dll文件

I don't knowhow stable they are but they work for sure. Credits goes to this link.

我不知道它们有多稳定,但它们确实有效。积分到这个链接。

http://x32.elijst.nl/php_memcache-5.4-nts-vc9-x86.zip

http://x32.elijst.nl/php_memcache - 5.4 - nt - vc9 x86.zip

http://x32.elijst.nl/php_memcache-5.4-vc9-x86.zip

http://x32.elijst.nl/php_memcache - 5.4 - vc9 x86.zip

It is the 2.2.5.0 version, I noticed after compiling it (for PHP 5.4.4).

我在编译后注意到它是2.2.5.0版本(对于PHP 5.4.4)。

Please note that it is not 2.2.6 but works. I also mirrored them in my own FTP. Mirror links:

请注意,它不是2.2.6,但是可以工作。我还在自己的FTP中镜像了它们。镜像链接:

http://mustafabugra.com/resim/php_memcache-5.4-vc9-x86.zip http://mustafabugra.com/resim/php_memcache-5.4-nts-vc9-x86.zip

http://mustafabugra.com/resim/php_memcache - 5.4 - vc9 x86.zip http://mustafabugra.com/resim/php_memcache - 5.4 - nt - vc9 x86.zip

#4


0  

The right is php_memcache.dll. In my case i was using lib compiled with vc9 instead of vc6 compiler. In apatche error logs i got something like:

正确的是php_memcache.dll。在我的例子中,我使用的是用vc9编译的lib,而不是vc6编译器。在apatche错误日志中,我得到了如下内容:

PHP Startup: sqlanywhere: Unable to initialize module Module compiled with build ID=API20090626, TS,VC9 PHP compiled with build ID=API20090626, TS,VC6 These options need to match

PHP启动:sqlanywhere:无法初始化使用构建ID=API20090626、TS、VC9 PHP编译的构建ID=API20090626、TS、VC6编译的模块,这些选项需要匹配

Check if you have same log and try downloading different dll that are compiled with different compiler.

检查是否有相同的日志,并尝试下载不同编译器编译的不同dll。

#5


-5  

I went into wp-config/ and deleted the object-cache.php and advanced-cache.php and it worked fine for me.

我进入了wp-config/并删除了对象缓存。php和高级高速缓存。php对我来说没问题。

#1


113  

There are two extensions for memcached in PHP, "memcache" and "memcached".

在PHP中,memcached有两个扩展,“memcache”和“memcached”。

It looks like you're trying to use one ("memcache"), but the other is installed ("memcached").

看起来您正在尝试使用一个(“memcache”),但是另一个已经安装(“memcached”)。

#2


19  

Dispite what the accepted answer says in the comments, the correct way to install 'Memcache' is:

抛开评论中公认的答案,安装“Memcache”的正确方法是:

sudo apt-get install php5-memcache

#3


1  

I found solution in this post: https://*.com/questions/11883378/class-memcache-not-found-php#=

我在这篇文章中找到了解决方案:https://*.com/questions/11883378/class-memcache- notfound -php#=。

I found the working dll files for PHP 5.4.4

我找到了PHP 5.4.4的工作dll文件

I don't knowhow stable they are but they work for sure. Credits goes to this link.

我不知道它们有多稳定,但它们确实有效。积分到这个链接。

http://x32.elijst.nl/php_memcache-5.4-nts-vc9-x86.zip

http://x32.elijst.nl/php_memcache - 5.4 - nt - vc9 x86.zip

http://x32.elijst.nl/php_memcache-5.4-vc9-x86.zip

http://x32.elijst.nl/php_memcache - 5.4 - vc9 x86.zip

It is the 2.2.5.0 version, I noticed after compiling it (for PHP 5.4.4).

我在编译后注意到它是2.2.5.0版本(对于PHP 5.4.4)。

Please note that it is not 2.2.6 but works. I also mirrored them in my own FTP. Mirror links:

请注意,它不是2.2.6,但是可以工作。我还在自己的FTP中镜像了它们。镜像链接:

http://mustafabugra.com/resim/php_memcache-5.4-vc9-x86.zip http://mustafabugra.com/resim/php_memcache-5.4-nts-vc9-x86.zip

http://mustafabugra.com/resim/php_memcache - 5.4 - vc9 x86.zip http://mustafabugra.com/resim/php_memcache - 5.4 - nt - vc9 x86.zip

#4


0  

The right is php_memcache.dll. In my case i was using lib compiled with vc9 instead of vc6 compiler. In apatche error logs i got something like:

正确的是php_memcache.dll。在我的例子中,我使用的是用vc9编译的lib,而不是vc6编译器。在apatche错误日志中,我得到了如下内容:

PHP Startup: sqlanywhere: Unable to initialize module Module compiled with build ID=API20090626, TS,VC9 PHP compiled with build ID=API20090626, TS,VC6 These options need to match

PHP启动:sqlanywhere:无法初始化使用构建ID=API20090626、TS、VC9 PHP编译的构建ID=API20090626、TS、VC6编译的模块,这些选项需要匹配

Check if you have same log and try downloading different dll that are compiled with different compiler.

检查是否有相同的日志,并尝试下载不同编译器编译的不同dll。

#5


-5  

I went into wp-config/ and deleted the object-cache.php and advanced-cache.php and it worked fine for me.

我进入了wp-config/并删除了对象缓存。php和高级高速缓存。php对我来说没问题。