問題背景:今天在新項目中調用了個發短信的接口,該接口是rpc封裝好的一個服務,代碼調用了\Redis::SERIALIZER_IGBINARY,本來在本地好好的,發到alpha環境報
Undefined class constant 'SERIALIZER_IGBINARY',Google了下發現是少了個igbinary擴展,因為我本地是裝好了的,所以本地正常運行,下面是解決方法 。
解決方法:
1、安裝igbinary擴展
1 wget http://pecl.php.net/get/igbinary-1.2.1.tgz 2 tar zxvf igbinary-1.2.1.tgz 3 cd igbinary-1.2.1 4 /usr/local/php/bin/phpize 5 ./configure --with-php-config=/usr/local/php/bin/php-config 6 make 7 make install
2、重新編譯phpredis擴展
直接刪除phpredis目錄,重新下載編譯
1 wget http://download.redis.io/releases/redis-2.6.14.tar.gz 2 tar zxvf redis-2.6.14.tar.gz 3 cd redis-2.6.14 4 /usr/local/php/bin/phpize 5 ./configure --enable-redis-igbinary --with-php-config=/usr/local/php/bin/php-config 6 make 7 make install
3、php.ini加載擴展
1 vim /usr/local/php/etc/php.ini 2 加上: 3 extensions=igbinary.so (加載redis 擴展之前) 4 extensions=redis .so
4、重啟配置文件
1 /etc/init.d/nginx reload 2 /etc/init.d/php-fpm restart
再重新訪問,success
