{"id":5567,"date":"2013-09-04T18:00:34","date_gmt":"2013-09-04T10:00:34","guid":{"rendered":"http:\/\/jpuyy.com\/?p=5567"},"modified":"2013-09-13T19:24:07","modified_gmt":"2013-09-13T11:24:07","slug":"install-phpredis-on-ubuntu","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=5567","title":{"rendered":"\u5728ubuntu\u4e0b\u5b89\u88c5phpredis"},"content":{"rendered":"<p>\u7ffb\u8bd1\u81ea\uff1a<a href=\"http:\/\/ricochen.wordpress.com\/2012\/03\/25\/install-phpredis-on-ubuntu\/\">http:\/\/ricochen.wordpress.com\/2012\/03\/25\/install-phpredis-on-ubuntu\/<\/a>\u00a0\u6253\u4e0d\u5f00\u4e0d\u602a\u6211\u3002<\/p>\n<p>\u572812.04 TLS\u4e0b\u6d4b\u8bd5\u53ef\u7528\u3002<\/p>\n<p>1) \u51c6\u5907\u5de5\u4f5c<\/p>\n<pre> sudo apt-get install php5-dev<\/pre>\n<p>php5-dev \u63d0\u4f9b\u4e86\u5f00\u53d1\u5e93\u53ca\u7f16\u8bd1\u5fc5\u987b\u7684phpize\u5de5\u5177<\/p>\n<p>2) \u83b7\u53d6phpredis\u6e90\u4ee3\u7801<\/p>\n<pre>git clone git:\/\/github.com\/nicolasff\/phpredis.git<\/pre>\n<p>3) \u7f16\u8bd1\u5b89\u88c5<\/p>\n<pre>cd phpredis\r\nphpize5\r\n.\/configure\r\nmake\r\nsudo -s make install<\/pre>\n<p>4) \u542f\u7528phpredis\u6269\u5c55<\/p>\n<pre>sudo -s\r\necho \"extension=redis.so\"&gt;\/etc\/php5\/conf.d\/redis.ini\r\nexit<\/pre>\n<p>5) \u5199\u4e00\u6bb5php\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5 (\u5728\u547d\u4ee4\u884c\u4e0b\u6d4b\u8bd5\u9700\u8981\u5148\u5b89\u88c5\u597dphp5-cli)\u3002\u4ee5\u4e0b\u662f\u5206\u522b\u4f7f\u7528phpredis\u4e0eRediska(<a href=\"https:\/\/github.com\/Shumkov\/Rediska\">https:\/\/github.com\/Shumkov\/Rediska<\/a>)\u8fdb\u884c\u6d4b\u8bd5\u3002\u5f88\u660e\u663e\u4f7f\u7528c\u7f16\u5199\u7684phpredis\u63d2\u4ef6\u6027\u80fd\u9ad8\u4e8ephp\u5e93Rediska\u3002<\/p>\n<p>phpredis_set.php\u5185\u5bb9\u548c\u6d4b\u8bd5\u7ed3\u679c\uff1a<\/p>\n<pre>&lt;?php\r\n \/\/ phpredis_set.php\r\n $redis=new Redis() or die(\"Can'f load redis module.\");\r\n $redis-&gt;connect('127.0.0.1');\r\n $redis-&gt;set('set_testkey', 1);<\/pre>\n<p>time for i in `seq 1 1000`; do php phpredis_set.php; done<\/p>\n<p>real 0m16.352s<br \/>\nuser 0m8.105s<br \/>\nsys 0m5.784s<\/p>\n<p>rediska_set.php\u5185\u5bb9\u548c\u6d4b\u8bd5\u7ed3\u679c\uff1a<\/p>\n<pre>&lt;?php\r\n require_once 'Rediska.php';\r\n $rediska=new Rediska();\r\n $rediska-&gt;set('set_testkey', 1);<\/pre>\n<p>time for i in `seq 1 1000`; do php rediska_set.php; done<\/p>\n<p>real 0m21.075s<br \/>\nuser 0m12.657s<br \/>\nsys 0m6.228s<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ffb\u8bd1\u81ea\uff1ahttp:\/\/ricochen.wordpress.com\/2012\/03\/25\/install-phpredis-on-ubuntu\/\u00a0\u6253\u4e0d\u5f00\u4e0d\u602a\u6211\u3002 \u572812.04 TLS\u4e0b\u6d4b\u8bd5\u53ef\u7528\u3002 1) \u51c6\u5907\u5de5\u4f5c sudo apt-get install php5-dev php5-dev \u63d0\u4f9b\u4e86\u5f00\u53d1\u5e93\u53ca\u7f16\u8bd1\u5fc5\u987b\u7684phpize\u5de5\u5177 2) \u83b7\u53d6phpredis\u6e90\u4ee3\u7801 git clone git:\/\/github.com\/nicolasff\/phpredis.git 3) \u7f16\u8bd1\u5b89\u88c5 cd phpredis phpize5 .\/configure make sudo -s make install 4) \u542f\u7528phpredis\u6269\u5c55 sudo -s echo &#8220;extension=redis.so&#8221;&gt;\/etc\/php5\/conf.d\/redis.ini exit 5) \u5199\u4e00\u6bb5php\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5 (\u5728\u547d\u4ee4\u884c\u4e0b\u6d4b\u8bd5\u9700\u8981\u5148\u5b89\u88c5\u597dphp5-cli)\u3002\u4ee5\u4e0b\u662f\u5206\u522b\u4f7f\u7528phpredis\u4e0eRediska(https:\/\/github.com\/Shumkov\/Rediska)\u8fdb\u884c\u6d4b\u8bd5\u3002\u5f88\u660e\u663e\u4f7f\u7528c\u7f16\u5199\u7684phpredis\u63d2\u4ef6\u6027\u80fd\u9ad8\u4e8ephp\u5e93Rediska\u3002 phpredis_set.php\u5185\u5bb9\u548c\u6d4b\u8bd5\u7ed3\u679c\uff1a &lt;?php \/\/ phpredis_set.php $redis=new Redis() or die(&#8220;Can&#8217;f load redis module.&#8221;); $redis-&gt;connect(&#8216;127.0.0.1&#8217;); $redis-&gt;set(&#8216;set_testkey&#8217;, 1); time for i in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[161],"class_list":["post-5567","post","type-post","status-publish","format-standard","hentry","category-life","tag-redis"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/5567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5567"}],"version-history":[{"count":9,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/5567\/revisions"}],"predecessor-version":[{"id":5621,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/5567\/revisions\/5621"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}