{"id":202306,"date":"2025-05-10T11:11:35","date_gmt":"2025-05-10T03:11:35","guid":{"rendered":"https:\/\/server.hk\/cnblog\/202306\/"},"modified":"2025-05-10T11:11:35","modified_gmt":"2025-05-10T03:11:35","slug":"php5-6%e4%b8%8d%e8%83%bd%e6%89%a9%e5%b1%95redis-so%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/202306\/","title":{"rendered":"php5.6\u4e0d\u80fd\u6269\u5c55redis.so\u5982\u4f55\u89e3\u51b3"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>php5.6\u4e0d\u80fd\u6269\u5c55redis.so\u5982\u4f55\u89e3\u51b3<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4eb2\u7231\u7684\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5982\u679c\u4f60\u70b9\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8bf4\u660e\u4f60\u5bf9\u300aphp5.6\u4e0d\u80fd\u6269\u5c55redis.so\u5982\u4f55\u89e3\u51b3\u300b\u5f88\u611f\u5174\u8da3\u3002\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u7ed9\u5927\u5bb6\u8be6\u7ec6\u89e3\u6790\u4e00\u4e0b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u6240\u6709\u8ba4\u771f\u8bfb\u5b8c\u7684\u7ae5\u978b\u4eec\uff0c\u90fd\u6709\u5b9e\u8d28\u6027\u7684\u63d0\u9ad8\u3002<\/p>\n<\/p>\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u6765\u4e86\u89e3\u4e00\u4e0bRedis\u662f\u4ec0\u4e48\u3002Redis\u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684\u952e\u503c\u5b58\u50a8\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b58\u50a8\u3001\u8bfb\u53d6\u548c\u64cd\u4f5c\u5404\u79cd\u7c7b\u578b\u7684\u6570\u636e\uff0c\u5982\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u8868\u3001\u5217\u8868\u3001\u96c6\u5408\u548c\u6709\u5e8f\u96c6\u5408\u7b49\u3002\u5b83\u4e3b\u8981\u4ee5\u5185\u5b58\u4e3a\u5b58\u50a8\u4ecb\u8d28\uff0c\u4f7f\u5f97Redis\u975e\u5e38\u5feb\u901f\u548c\u9ad8\u6548\u3002<\/p>\n<p>PHP\u901a\u8fc7\u6269\u5c55redis.so\u6216phpredis\u6269\u5c55\u6765\u4e0eRedis\u8fdb\u884c\u4ea4\u4e92\u3002\u8fd9\u4e9b\u6269\u5c55\u63d0\u4f9b\u4e86\u5404\u79cdAPI\u51fd\u6570\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u53ef\u4ee5\u5728PHP\u4ee3\u7801\u4e2d\u65b9\u4fbf\u5730\u8bbf\u95eeRedis\u3002\u7136\u800c\uff0c\u5728\u4e00\u4e9b\u7248\u672c\u7684PHP\u4e2d\uff0c\u7279\u522b\u662fphp5.6\u7248\u672c\u4e2d\uff0c\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\uff0c\u5bfc\u81f4\u8fd9\u4e9b\u6269\u5c55\u4e0d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<p>\u5982\u679c\u4f60\u4f7f\u7528php5.6\u7248\u672c\uff0c\u5e76\u4e14\u5c1d\u8bd5\u5b89\u88c5\u548c\u4f7f\u7528phpredis\u6269\u5c55\u6216\u8005\u76f4\u63a5\u6269\u5c55redis.so\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u5982\u4e0b\u9519\u8bef\u4fe1\u606f\uff1a<\/p>\n<pre>PHP&nbsp;Warning:&nbsp;PHP&nbsp;Startup:&nbsp;Unable&nbsp;to&nbsp;load&nbsp;dynamic&nbsp;library&nbsp;'\/usr\/lib64\/php5.6\/modules\/redis.so'&nbsp;-&nbsp;\/usr\/lib64\/php5.6\/modules\/redis.so:&nbsp;undefined&nbsp;symbol:&nbsp;igbinary_serialize&nbsp;in&nbsp;Unknown&nbsp;on&nbsp;line&nbsp;0<\/pre>\n<p>\u8fd9\u4e2a\u9519\u8bef\u4fe1\u606f\u610f\u5473\u7740\u4f60\u7684PHP\u7248\u672c\u4e0d\u5305\u542bigbinary\u6269\u5c55\uff0c\u8fd9\u4e2a\u6269\u5c55\u662fphpredis\u6269\u5c55\u7684\u4e00\u4e2a\u4f9d\u8d56\u9879\u3002igbinary\u662f\u4e00\u4e2aPHP\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u6269\u5c55\uff0c\u5b83\u53ef\u4ee5\u63d0\u9ad8Redis\u8bbf\u95ee\u901f\u5ea6\u548c\u6027\u80fd\u3002<\/p>\n<p>\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f60\u9700\u8981\u5148\u5b89\u88c5igbinary\u6269\u5c55\uff0c\u7136\u540e\u518d\u5b89\u88c5phpredis\u6269\u5c55\u6216\u6269\u5c55redis.so\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5igbinary\u6269\u5c55<\/strong><br \/>\u4e0b\u8f7d\u5e76\u7f16\u8bd1igbinary\u6269\u5c55\uff0c\u7136\u540e\u5c06\u5176\u5b89\u88c5\u5230\u4f60\u7684PHP\u6269\u5c55\u76ee\u5f55\u4e2d\u3002\u4f60\u53ef\u4ee5\u4eceGitHub\u4e0a\u4e0b\u8f7digbinary\uff1a<\/p>\n<p><\/p>\n<pre>$ git clone https:\/\/github.com\/igbinary\/igbinary.git\r\n$ cd igbinary\r\n$ phpize\r\n$ .\/configure\r\n$ make\r\n$ sudo make install\r\n<\/pre>\n<p><\/p>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u4f60\u9700\u8981\u5c06igbinary.so\u6587\u4ef6\u590d\u5236\u5230PHP\u6269\u5c55\u76ee\u5f55\uff0c\u5e76\u5728php.ini\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n<p><\/p>\n<pre>extension=igbinary.so\r\n<\/pre>\n<p><\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5phpredis\u6269\u5c55<\/strong><br \/>\u4e0b\u8f7d\u5e76\u7f16\u8bd1phpredis\u6269\u5c55\uff0c\u7136\u540e\u5c06\u5176\u5b89\u88c5\u5230\u4f60\u7684PHP\u6269\u5c55\u76ee\u5f55\u4e2d\u3002\u4f60\u53ef\u4ee5\u4eceGitHub\u4e0a\u4e0b\u8f7dphpredis\uff1a<\/p>\n<p><\/p>\n<pre>$ git clone https:\/\/github.com\/phpredis\/phpredis.git\r\n$ cd phpredis\r\n$ phpize\r\n$ .\/configure\r\n$ make\r\n$ sudo make install\r\n<\/pre>\n<p><\/p>\n<p>\u7136\u540e\uff0c\u5728php.ini\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n<\/p>\n<pre><code>extension=redis.so\r\n<\/code><\/pre>\n<p><\/p>\n<\/li>\n<li>\n<p><strong>\u6269\u5c55redis.so<\/strong><br \/>\u5982\u679c\u4f60\u4e0d\u60f3\u4f7f\u7528phpredis\u6269\u5c55\uff0c\u800c\u5e0c\u671b\u76f4\u63a5\u6269\u5c55redis.so\uff0c\u90a3\u4e48\u4f60\u9700\u8981\u7f16\u8bd1PHP\u6e90\u7801\uff0c\u5e76\u542f\u7528Redis\u6269\u5c55\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/li>\n<\/ol>\n<p>\u9996\u5148\uff0c\u4e0b\u8f7dPHP\u6e90\u7801\u5e76\u89e3\u538b\u7f29\uff1a<\/p>\n<pre>$&nbsp;wget&nbsp;http:\/\/cn2.php.net\/distributions\/php-5.6.40.tar.gz\n$&nbsp;tar&nbsp;zxvf&nbsp;php-5.6.40.tar.gz\n$&nbsp;cd&nbsp;php-5.6.40<\/pre>\n<p>\u7136\u540e\uff0c\u5728.\/configure\u547d\u4ee4\u4e2d\u542f\u7528Redis\u6269\u5c55\uff1a<\/p>\n<pre>$&nbsp;.\/configure&nbsp;--with-redis<\/pre>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528make\u547d\u4ee4\u7f16\u8bd1PHP\u6e90\u7801\uff1a<\/p>\n<pre>$&nbsp;make<\/pre>\n<p>\u5b8c\u6210\u7f16\u8bd1\u540e\uff0c\u5c06redis.so\u6587\u4ef6\u590d\u5236\u5230PHP\u6269\u5c55\u76ee\u5f55\u4e2d\uff1a<\/p>\n<pre>$&nbsp;sudo&nbsp;cp&nbsp;modules\/redis.so&nbsp;\/usr\/lib64\/php5.6\/modules\/<\/pre>\n<p>\u6700\u540e\uff0c\u5728php.ini\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n<p><code><code><\/code><\/code><\/p>\n<pre><code><code>extension=redis.so<\/code><\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>php5.6\u4e0d\u80fd\u6269\u5c55redis.&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-202306","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/202306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=202306"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/202306\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=202306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=202306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=202306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}