致命错误:类'内存缓存'未找到(PECL与安装) [英] Fatal error: Class 'Memcache' not found (installed with pecl)

查看:236
本文介绍了致命错误:类'内存缓存'未找到(PECL与安装)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过ssh安装内存缓存,搭配:

  $ PECL安装内存缓存

这是输出: https://pastee.org/w63sy

和加入这一行等/ php.ini中

 扩展= memcache.so

和尝试初始化时:

  / * * MEMCACHE /
$ =内存缓存内存缓存的新();
$ memcache-> pconnect('localhost'的,11211);

我得到:

 致命错误:类'内存缓存'在/home/piscolab/public_html/website.com/includes/sql.php没有发现25行

我在做什么错了?

我发现这个问题,但问题是他的共享服务器。我是一个VPS下。

运行: PHP -i | grep的php.ini文件

  [根@ VPS〜]#PHP -i | php.ini中的grep
PHP的警告:PHP启动:无法加载动态库'/usr/lib/php/modules/memcache.so' - /usr/lib/php/modules/memcache.so:无法打开共享对象文件:没有这样的文件Ø
- [R目录在未知在线0
配置文件(php.ini中)路径=>在/ etc
加载配置文件= GT; /etc/php.ini中
[根@ VPS〜]#

查找memcache.so(无输出)

  [根@ VPS〜]#查找/型的F -name内存缓存*。所以'
[根@ VPS〜]#查找/型的F -name内存缓存*的.so
[根@ VPS〜]#


解决方案

由于错误信息的输出,它看起来像你缺少的zlib 开发库,或至少他们不是在通常的位置,它可以通过配置自动找到。

既然你是在CentOS,尝试用这个命令安装库:

 百胜安装的zlib-DEVEL

这将安装这是需要内存缓存zlib库。尝试重新安装运行zlib的图书馆后PECL安装程序。

I installed memcache via ssh, with:

$ pecl install memcache

And this was the output: https://pastee.org/w63sy

And added this line to etc/php.ini:

extension=memcache.so

And when trying to initialize:

/* MEMCACHE */
$memcache = new Memcache();
$memcache->pconnect('localhost',11211);

I get:

Fatal error: Class 'Memcache' not found in /home/piscolab/public_html/website.com/includes/sql.php on line 25

What am I doing wrong?

I found this question but the problem was about his shared server. I am under a VPS.

Running: php -i | grep php.ini:

[root@vps ~]# php -i | grep php.ini                                                                                                                                            
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/memcache.so' - /usr/lib/php/modules/memcache.so: cannot open shared object file: No such file o
r directory in Unknown on line 0                                                                                                                                               
Configuration File (php.ini) Path => /etc                                                                                                                                      
Loaded Configuration File => /etc/php.ini                                                                                                                                      
[root@vps ~]#    

Finding memcache.so (no output)

[root@vps ~]# find / -type f -name memcache*.so'                                                                                                                              
[root@vps ~]# find / -type f -name memcache*.so                                                                                                                                
[root@vps ~]#

解决方案

Given the output of the error message, it looks like you are missing the zlib development libraries, or at least they are not in the usual location where it can be automatically found by configure.

Since you are on CentOS, try installing the libraries with this command:

yum install zlib-devel

This installs the zlib library which is required for memcache. Try re-running the pecl installer after installing the zlib libraries.

这篇关于致命错误:类'内存缓存'未找到(PECL与安装)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆