Download 1: Download The redis extension package gitclonegithub from git. comnicolasffphpredis 2 mount: Enter phpize in shell [view the appropriate version information] {code ...} phpize is used to expand the php extension module. phpize can be used to establish php... download 1: Download The redis extension package from git
Git clone https://github.com/nicolasff/phpredis
2. Mount: Enter phpize in shell to view the appropriate version information]
./Configure Compilation
Phpize is used to expand the php extension module. phpize can be used to establish a php plug-in module]
Note: (if phpize contains multiple php files, the location must be specified)
cuihuan:phpredis cuixiaohuan$ phpizeConfiguring for:PHP Api Version: 20121113Zend Module Api No: 20121212Zend Extension Api No: 220121212Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
If an error is reported, install brew install autoconf [phpize Error]. Otherwise, no phpize exists.
[work@cuixiaozhuai phpredis]$ phpize Configuring for:PHP Api Version: 20041225Zend Module Api No: 20060613Zend Extension Api No: 220060519[work@cuixiaozhuai phpredis]$ ./configure
When multiple php versions exist, you must specify the configuration file
./configure --with-php-config=/home/work/thirdparty/php5/bin/php-config
Three installation: make test is best to make install after make
Build complete.Don't forget to run 'make test'.cuihuan:phpredis cuixiaohuan$ make test
Problem 4: [fixed, but the cause may be inaccurate]
Make compilation Error
.libs/redis_cluster.o(.data.rel.local+0x0): In function `ht_free_seed':/home/work/thirdparty/php5/php5/phpredis/redis_cluster.c:226: multiple definition of `arginfo_scan'.libs/redis.o(.data.rel.local+0xe0):/home/work/thirdparty/php5/php5/p hpredis/redis.c:452: first defined here/usr/bin/ld: Warning: size of symbol `arginfo_scan' changed from 160 in .libs/redis.o to 200 in .libs/redis_cluster.o.libs/redis_cluster.o(.data.rel.local+0xe0): In function `create_cluster_context':/home/work/thirdparty/php5/php5/phpredis/redis_cluster.c:276: multiple definition of `arginfo_kscan'.libs/redis.o(.data.rel.local+0x0):/home/work/thirdparty/php5/php5/phpredis/redis.c:364: first defined herecollect2: ld returned 1 exit statusmake: *** [redis.la] Error 1
It was initially thought that the install issue was generated by multiple php versions. Use./configure to specify the php version and the php location.
However, there is still a problem with the effect.
Finally, by modifying redis_cluester.c, the two duplicate
40 41 /* Argument info for HSCAN, SSCAN, HSCAN */ 42 /*ZEND_BEGIN_ARG_INFO_EX(arginfo_kscan, 0, 0, 2) 43 ZEND_ARG_INFO(0, str_key) 44 ZEND_ARG_INFO(1, i_iterator) 45 ZEND_ARG_INFO(0, str_pattern) 46 ZEND_ARG_INFO(0, i_count) 47 ZEND_END_ARG_INFO(); 48 */ 49 50 /* Argument infor for SCAN */ 51 /* 52 ZEND_BEGIN_ARG_INFO_EX(arginfo_scan, 0, 0, 2) 53 ZEND_ARG_INFO(1, i_iterator) 54 ZEND_ARG_INFO(0, str_node) 55 ZEND_ARG_INFO(0, str_pattern) 56 ZEND_ARG_INFO(0, i_count) 57 ZEND_END_ARG_INFO(); 58 */
5. perform a simple php Operation Test
connect('127.0.0.1',6379); echo "redis pass and status show
"; var_dump($redis->ping()); $redis->set('test_key','test_value'); echo "test set val=".$redis->get('test_key')."
"; $redis->setnx('unique_key',"unique_val"); $redis->setnx('unique_key',"unique_val_2"); echo $redis->get("unique_key"); sleep(60); echo 'is exist'.$redis->exists('test_60s'); echo 'not has value'.$redis->get('test_60s'); $redis->delete('test_key','test_60s');
Reply: 1. Download The redis extension package from git.
Git clone https://github.com/nicolasff/phpredis
2. Mount: Enter phpize in shell to view the appropriate version information]
./Configure Compilation
Phpize is used to expand the php extension module. phpize can be used to establish a php plug-in module]
Note: (if phpize contains multiple php files, the location must be specified)
cuihuan:phpredis cuixiaohuan$ phpizeConfiguring for:PHP Api Version: 20121113Zend Module Api No: 20121212Zend Extension Api No: 220121212Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
If an error is reported, install brew install autoconf [phpize Error]. Otherwise, no phpize exists.
[work@cuixiaozhuai phpredis]$ phpize Configuring for:PHP Api Version: 20041225Zend Module Api No: 20060613Zend Extension Api No: 220060519[work@cuixiaozhuai phpredis]$ ./configure
When multiple php versions exist, you must specify the configuration file
./configure --with-php-config=/home/work/thirdparty/php5/bin/php-config
Three installation: make test is best to make install after make
Build complete.Don't forget to run 'make test'.cuihuan:phpredis cuixiaohuan$ make test
Problem 4: [fixed, but the cause may be inaccurate]
Make compilation Error
.libs/redis_cluster.o(.data.rel.local+0x0): In function `ht_free_seed':/home/work/thirdparty/php5/php5/phpredis/redis_cluster.c:226: multiple definition of `arginfo_scan'.libs/redis.o(.data.rel.local+0xe0):/home/work/thirdparty/php5/php5/p hpredis/redis.c:452: first defined here/usr/bin/ld: Warning: size of symbol `arginfo_scan' changed from 160 in .libs/redis.o to 200 in .libs/redis_cluster.o.libs/redis_cluster.o(.data.rel.local+0xe0): In function `create_cluster_context':/home/work/thirdparty/php5/php5/phpredis/redis_cluster.c:276: multiple definition of `arginfo_kscan'.libs/redis.o(.data.rel.local+0x0):/home/work/thirdparty/php5/php5/phpredis/redis.c:364: first defined herecollect2: ld returned 1 exit statusmake: *** [redis.la] Error 1
It was initially thought that the install issue was generated by multiple php versions. Use./configure to specify the php version and the php location.
However, there is still a problem with the effect.
Finally, by modifying redis_cluester.c, the two duplicate
40 41 /* Argument info for HSCAN, SSCAN, HSCAN */ 42 /*ZEND_BEGIN_ARG_INFO_EX(arginfo_kscan, 0, 0, 2) 43 ZEND_ARG_INFO(0, str_key) 44 ZEND_ARG_INFO(1, i_iterator) 45 ZEND_ARG_INFO(0, str_pattern) 46 ZEND_ARG_INFO(0, i_count) 47 ZEND_END_ARG_INFO(); 48 */ 49 50 /* Argument infor for SCAN */ 51 /* 52 ZEND_BEGIN_ARG_INFO_EX(arginfo_scan, 0, 0, 2) 53 ZEND_ARG_INFO(1, i_iterator) 54 ZEND_ARG_INFO(0, str_node) 55 ZEND_ARG_INFO(0, str_pattern) 56 ZEND_ARG_INFO(0, i_count) 57 ZEND_END_ARG_INFO(); 58 */
5. perform a simple php Operation Test
connect('127.0.0.1',6379); echo "redis pass and status show
"; var_dump($redis->ping()); $redis->set('test_key','test_value'); echo "test set val=".$redis->get('test_key')."
"; $redis->setnx('unique_key',"unique_val"); $redis->setnx('unique_key',"unique_val_2"); echo $redis->get("unique_key"); sleep(60); echo 'is exist'.$redis->exists('test_60s'); echo 'not has value'.$redis->get('test_60s'); $redis->delete('test_key','test_60s');