PHP Warning: PHP Startup: redis: Unable to initialize module Windows版本phpredis扩展

版权声明:经验之谈,不知能否换包辣条,另,转载请注明出处。https://www.cnblogs.com/zmdComeOn/category/1295248.html

[root@VM_0_2_centos phpredis-master]# /usr/local/php5.6/sbin/php-fpm reload
[06-Sep-2018 18:19:35] NOTICE: PHP message: PHP Warning:  PHP Startup: redis: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0
Usage: php-fpm [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F [-O]]
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -h               This help
  -i               PHP information
  -m               Show compiled in modules
  -v               Version number
  -p, --prefix <dir>
                   Specify alternative prefix path to FastCGI process manager (default: /usr/local/php5.6).
  -g, --pid <file>
                   Specify the PID file location.
  -y, --fpm-config <file>
                   Specify alternative path to FastCGI process manager config file.
  -t, --test       Test FPM configuration and exit
  -D, --daemonize  force to run in background, and ignore daemonize option from config file
  -F, --nodaemonize
                   force to stay in foreground, and ignore daemonize option from config file
  -O, --force-stderr
                   force output to stderr in nodaemonize even if stderr is not a TTY
  -R, --allow-to-run-as-root
                   Allow pool to run as root (disabled by default)

我是在安装redis的时候碰到类似问题,当时没有记录,因为很快就被修复了,说一说出现这个问题的原因,只有一个: 
你下载的拓展和你的php版本不符合! 

phpinfo里面的重要信息,nts,x86

当我们使用phpinfo的时候,多数时候都是在看模块有没有装上,但是其他重要信息却忽略了,例如,为啥我的拓展老是装不上,下载的拓展上面一长串啥意思?nts x86 5.5等等,这些都是重要的信息,对于安装拓展来说尤其重要! 
这里写图片描述

上面的几个重要参数:

1 compiler :编译器
2 Architecture :CPU架构
3 Configuration File (php.ini) Path :php配置文件的位置,这里才是你的配置文件加载的真正地方,apache的同学小心了!
4 Thread Safety :线程安全与否
5 PHP Extension Build :php拓展建立的编号

以上几个参数关系到你能不能装上拓展,要认真看!下载拓展.dll文件的时候很多选项,那里面的选项就和这里的对应! 
例如下面: 
随便取一个来分析下:

1 php_igbinary-1.2.1-5.3-nts-vc9-x86.zip

意思是:1.2.1版本的php_igbinary拓展,适合的php版本是5.3及以上,vc9编译的这个拓展,,不支持线程安全,可以用在x86 cpu架构上,注意64位的机器也可以用!但是反过来就不行了。

这里写图片描述

是不是清楚很多了?我是在安装redis的时候碰到这个问题的。

原文地址:https://www.cnblogs.com/zmdComeOn/p/9600267.html