{"id":33810,"date":"2023-05-14T11:19:59","date_gmt":"2022-12-03T00:46:15","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/"},"modified":"2024-01-15T08:02:10","modified_gmt":"2024-01-15T00:02:10","slug":"%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/","title":{"rendered":"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis"},"content":{"rendered":"<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>su\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\n<span class=\"nv\">$ <\/span>wget http:\/\/redis.googlecode.com\/files\/redis-2.6.12.tar.gz\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">tar <\/span>xzf redis-2.6.12.tar.gz\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">cd <\/span>redis-2.6.12\r\n<span class=\"nv\">$ <\/span>make<span class=\"p\">;<\/span>make <span class=\"nb\">install<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/usr\/local\/src\/redis-2.6.12 \/usr\/local\/redis\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo mkdir<\/span> <span class=\"nt\">-pv<\/span> \/var\/data\/redis\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo chown<\/span> <span class=\"nt\">-R<\/span> root:wheel \/var\/data\/redis\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5728\u7f16\u8bd1\u9636\u6bb5\uff0c\u51fa\u73b0\u4e86\u6ca1\u6709gcc\u5bfc\u81f4\u7684\u9519\u8bef<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nb\">install <\/span>gcc\r\n<span class=\"nv\">$ <\/span>make distclean\r\n<span class=\"nv\">$ <\/span>make<span class=\"p\">;<\/span>make <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>-dir .\/\r\n+dir \/var\/data\/redis\/\r\n<\/code><\/pre>\n<h3>PHP\u4f7f\u7528\u7684\u5e93<\/h3>\n<h4>\u5b89\u88c5phpredis<\/h4>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>su\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\n<span class=\"nv\">$ <\/span>git clone git:\/\/github.com\/nicolasff\/phpredis.git\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">cd <\/span>phpredis\/\r\n<span class=\"nv\">$ <\/span>phpize\r\n<span class=\"nv\">$ <\/span>.\/configure\r\n<span class=\"nv\">$ <\/span>make<span class=\"p\">;<\/span>make <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<p>-rwxr-xr-x 1 \u6839 \u7528\u6237\u7ec4 845018 \u4e94\u6708 1 02:05 \/usr\/lib64\/php\/modules\/redis.so<\/p>\n<p>\u5982\u679c\u8981\u6709\u6548\u5730\u4f7f\u7528serialize\u7684\u8bdd<\/p>\n<p>\u4e3a\u4e86\u4f18\u5316\u5728Memcached\u6269\u5c55\u5185\u8fdb\u884c\u7684\u5e8f\u5217\u5316\u5904\u7406\uff0c\u5f15\u5165\u4e86igbinary\u6269\u5c55\u3002<\/p>\n<p>\u514b\u9686 git:\/\/github.com\/igbinary\/igbinary.git \u4ee3\u7801\u5e93<br \/>\n\u8fdb\u5165 igbinary \u76ee\u5f55<br \/>\n\u8fd0\u884c phpize<br \/>\n\u6267\u884c .\/configure CFLAGS=&#8221;-O2 -g&#8221; &#8211;enable-igbinary<br \/>\n\u7f16\u8bd1\u5e76\u5b89\u88c5 make;make install<\/p>\n<p>-rwxr-xr-x 1 \u6839 \u6839 176964 \u4e94\u6708 1 02:17 \/usr\/lib64\/php\/modules\/igbinary.so<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">echo<\/span> <span class=\"s2\">\"extension=igbinary.so\"<\/span> <span class=\"o\">&gt;<\/span> \/etc\/php.d\/igbinary.ini\r\n<\/code><\/pre>\n<p>\u5207\u6362\u5230..\/phprize\u76ee\u5f55\uff0c\u5728\u6b64\u76ee\u5f55\u4e0b\u6267\u884c\u547d\u4ee4.\/configure &#8211;enable-redis-igbinary\uff0c\u7136\u540e\u7ee7\u7eed\u6267\u884cmake\u548cmake install\u547d\u4ee4\u3002\u6700\u540e\uff0c\u53ef\u4ee5\u5728\/usr\/lib64\/php\/modules\/\u76ee\u5f55\u4e0b\u627e\u5230\u540d\u4e3aredis.so\u7684\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u7684\u6743\u9650\u4e3a-rwxr-xr-x\uff0c\u5927\u5c0f\u4e3a845858\u5b57\u8282\uff0c\u521b\u5efa\u65f6\u95f4\u4e3a5\u67081\u65e502:21\uff0c\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4\u5747\u4e3aroot\u3002<\/p>\n<h4>\u5411 php.ini \u6587\u4ef6\u6dfb\u52a0\u5185\u5bb9\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"nb\">echo<\/span> <span class=\"s2\">\"extension=redis.so\"<\/span> <span class=\"o\">&gt;<\/span> \/etc\/php.d\/redis.ini\r\n<\/code><\/pre>\n<h4>\u786e\u8ba4Redis<\/h4>\n<pre class=\"post-pre\"><code>php <span class=\"nt\">-m<\/span> | <span class=\"nb\">grep <\/span>redis\r\n<\/code><\/pre>\n<h4>\u6587\u4ef6<\/h4>\n<p>&#8220;Redis\u5ba2\u6237\u7aef\u5217\u8868&#8221;: http:\/\/redis.io\/clients<br \/>\n\u5982\u679c\u8981\u5728AWS\u4e0a\u8fdb\u884c\u90e8\u7f72: http:\/\/dev.classmethod.jp\/server-side\/in-memory-kvs-redis\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>$ sudo su $ cd \/usr\/local\/src $ wget http:\/\/redis.googl [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-33810","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728php\u4e2d\u4f7f\u7528redis\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis\" \/>\n<meta property=\"og:description\" content=\"$ sudo su $ cd \/usr\/local\/src $ wget http:\/\/redis.googl [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728php\u4e2d\u4f7f\u7528redis\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-03T00:46:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T00:02:10+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/\",\"name\":\"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-12-03T00:46:15+00:00\",\"dateModified\":\"2024-01-15T00:02:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728php\u4e2d\u4f7f\u7528redis\/","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis","og_description":"$ sudo su $ cd \/usr\/local\/src $ wget http:\/\/redis.googl [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728php\u4e2d\u4f7f\u7528redis\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-12-03T00:46:15+00:00","article_modified_time":"2024-01-15T00:02:10+00:00","author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/","name":"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-12-03T00:46:15+00:00","dateModified":"2024-01-15T00:02:10+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010\u5907\u5fd8\u5f55\u3011\u76f4\u5230\u5728PHP\u4e2d\u4f7f\u7528Redis"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e7%9b%b4%e5%88%b0%e5%9c%a8php%e4%b8%ad%e4%bd%bf%e7%94%a8redis\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=33810"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33810\/revisions"}],"predecessor-version":[{"id":57597,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33810\/revisions\/57597"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=33810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=33810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=33810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}