redis.so模块没有加载 [英] redis.so module is not loaded

查看:2660
本文介绍了redis.so模块没有加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对亚马逊网络服务的EC2实例,并在同一个VPC另外还有ElastiCache(Redis的)的一个实例。 我的EC2实例已经安装亚马逊的Linux AMI 2015.09。我也配置它mpm_worker_module而不是prefork工作。配置是否正确工作,我可以访问我的浏览器的页面。

I have an EC2 instance on Amazon Web Services and, in the same VPC there's also an instance of ElastiCache (Redis). My EC2 instance have installed Amazon Linux AMI 2015.09. I have also configured it to work with mpm_worker_module and not prefork. The configuration is correctly working and I can access pages from my browser.

我已经再装Redis的客户端,Redis的-CLI命令是完全从SSH的工作。

I have then installed redis client, and the redis-cli command is perfectly working from ssh.

我已经再装pH值preDIS(的https:// github上。 -O pH值predis.zip COM / nicolasff / PH preDIS / zipball /主),我创建了一个简单的PHP脚本来检查它是否工作正常(一个简单的index.php)。

I have then installed phpredis (https://github.com/nicolasff/phpredis/zipball/master -O phpredis.zip) and I have created a simple PHP script to check if it's working properly (a simple index.php).

如果我从启动ssh控制台(即PHP的index.php)这个脚本它的伟大工程。如果我启动相同的脚本试图从我的浏览器打开网页我得到这个错误: 致命错误:类'Redis的'未找到

If I launch this script from ssh console (i.e. php index.php) it works great. If I launch the same script trying to open the page from my browser I get this error: Fatal error: Class 'Redis' not found

在Apache我php.conf文件如下:

My php.conf file inside apache is the following:

<IfModule prefork.c>
  LoadModule php5_module modules/libphp-5.6.so
</IfModule>
<IfModule !prefork.c>
  LoadModule php5_module modules/libphp-zts-5.6.so
</IfModule>

在/etc/php-zts-5.6.d我已经添加的文件redis.ini里面的文件夹

In folder /etc/php-zts-5.6.d I have added the file "redis.ini" with inside

extension = redis.so

我也注意到,Redis的安装添加redis.so仅此文件夹

I have also noticed that redis installation adds redis.so only to this folder

 /usr/lib64/php/5.6/modules/

而不是 /usr/lib64/php-zts/5.6/modules / 文件夹,所以我从一个文件夹到另一个复制它。但它仍然没有工作,用同样的错误:

And not to /usr/lib64/php-zts/5.6/modules/ folder, so I copied it from one folder to the other. But it's still not working, with same error:

Fatal error: Class 'Redis' not found

相反,如果我使用preDIS,以包括autoload.php的,它工作正常。但我想有安装pH值preDIS,导致我们的系统将使得数以千计的电话每一秒钟Redis的服务器,和pH值preDIS会快很多,因为它的编译。

Instead, if I use Predis, with "include" of autoload.php, it works fine. But I'd like to have installed phpredis, cause our system will make thousands of calls each second to Redis Server, and phpredis will be much faster since it's compiled.

我是什么做错了吗?

修改 在我的Redis的错误日志中我得到这个消息

Edit In my redis error log I get this message

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/redis.so' - /usr/lib64/php/5.6/modules/redis.so: undefined symbol: compiler_globals in Unknown on line 0

另外,如果我使用prefork模块,它的伟大工程。如果我用的是工人,我得到了上面的错误。

Plus, if I use the prefork module, it works great. If I use the worker, I got the above error.

推荐答案

解决的办法是做以下步骤来安装pH值为preDIS:

The solution was doing the following steps to install phpredis:

  • 在下载并解压pH值$​​ P $ PDIS
  • 命令 ZTS-运行phpize
  • 命令 ./配置--with-PHP-配置=的/ usr / bin中/ ZTS-PHP-配置
  • 命令制作和放大器;&安培;使安装
  • download and unzip phpredis
  • command zts-phpize
  • command ./configure --with-php-config=/usr/bin/zts-php-config
  • command make && make install

我在做运行phpize ,而不是 ZTS-运行phpize ,我并没有加入 --with-PHP-配置选项:这是问题

I was doing phpize and not zts-phpize and I was not adding the --with-php-config option: this was the problem

当然,你必须添加redis.ini到/etc/php-zts-5.6.d/文件夹,里面的文件:

Of course then you have to add redis.ini into /etc/php-zts-5.6.d/ folder with, inside the file:

extension=redis.so

重新启动Apache和它应该工作

Restart apache and it should work

希望这会帮助别人

P.S。如果你想让它的命令行(即PHP的script.php)工作,你也必须安装它与运行phpize 和简单的 ./配置命令。

P.S. If you want it to work from command line (i.e. "php script.php"), you have to install it also with phpize and simple ./configure command.

这篇关于redis.so模块没有加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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