Phpredis Extended Installation

Source: Internet
Author: User

Download: Git downloads the Redis expansion pack

git clone Https://github.com/nicolasff/phpredis

Two mounts: Enter Phpize "View appropriate version information" in the shell

 ./configure 编译

"Phpize is used to extend the PHP extension module, through phpize can build PHP plug-in module"

Note: (phpize if multiple PHP is included, you must specify a location)

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 you have an error, you need to install: Brew Install autoconf [phpize ERROR] otherwise no phpize

[work@cuixiaozhuai phpredis]$ phpize        Configuring for:PHP Api Version:         20041225Zend Module Api No:      20060613Zend Extension Api No:   220060519[work@cuixiaozhuai phpredis]$ ./configure

When there are multiple versions of PHP, you need to specify the configuration file

Three installs: Make Test best make install after make

Build complete.Don't forget to run 'make test'.cuihuan:phpredis cuixiaohuan$ make test

Four-issue bug fix: "fixed, but may not be accurate"

Make compile 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

Originally thought to be PHP multiple version generation install problem, use./configure Specify PHP version, specify PHP location.
But the effect is still a problem.
Finally, by modifying the REDIS_CLUESTER.C, the two duplicates are commented out.

  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 */    

Five for 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 content:

Download: Git downloads the Redis expansion pack

git clone Https://github.com/nicolasff/phpredis

Two mounts: Enter Phpize "View appropriate version information" in the shell

 ./configure 编译

"Phpize is used to extend the PHP extension module, through phpize can build PHP plug-in module"

Note: (phpize if multiple PHP is included, you must specify a location)

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 you have an error, you need to install: Brew Install autoconf [phpize ERROR] otherwise no phpize

[work@cuixiaozhuai phpredis]$ phpize        Configuring for:PHP Api Version:         20041225Zend Module Api No:      20060613Zend Extension Api No:   220060519[work@cuixiaozhuai phpredis]$ ./configure

When there are multiple versions of PHP, you need to specify the configuration file

Three installs: Make Test best make install after make

Build complete.Don't forget to run 'make test'.cuihuan:phpredis cuixiaohuan$ make test

Four-issue bug fix: "fixed, but may not be accurate"

Make compile 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

Originally thought to be PHP multiple version generation install problem, use./configure Specify PHP version, specify PHP location.
But the effect is still a problem.
Finally, by modifying the REDIS_CLUESTER.C, the two duplicates are commented out.

  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 */    

Five for 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');
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.