{"id":607,"date":"2020-08-20T15:45:07","date_gmt":"2020-08-20T07:45:07","guid":{"rendered":"https:\/\/www.kiccleaf.com\/?p=607"},"modified":"2020-08-27T17:21:44","modified_gmt":"2020-08-27T09:21:44","slug":"centos7%e5%ae%89%e8%a3%85php7-4-9redis%e6%89%a9%e5%b1%95","status":"publish","type":"post","link":"http:\/\/www.kiccleaf.com\/?p=607","title":{"rendered":"Centos7\u5b89\u88c5php7.4.9+redis\u6269\u5c55"},"content":{"rendered":"\n<p>\u672c\u6587\u53ea\u8bb2php\u7684\u7f16\u8bd1\u53caRedis\u6269\u5c55\u7684\u5b89\u88c5\uff0c\u5176\u4ed6nginx\u7684\u5b89\u88c5\u4ec0\u4e48\u90fd\u76f8\u540c\u65b9\u5f0f\u65e0\u975e\u5c31\u662f\u914d\u7f6e\u9700\u8981\u4fee\u6539\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p>php7.4.9\u5b89\u88c5\u5305\u4e0b\u8f7d\uff1a<a href=\"https:\/\/www.php.net\/downloads.php#v7.4.9\">https:\/\/www.php.net\/downloads.php#v7.4.9<\/a><\/p>\n\n\n\n<p>\u6211\u4e0b\u8f7d\u4e86\uff1ahttps:\/\/www.php.net\/distributions\/php-7.4.9.tar.bz2<\/p>\n\n\n\n<p>\u89e3\u538b tar  jzvf php-7.4.9.tar.bz2\uff0c\u5e76\u6253\u5f00php-7.4.9\u76ee\u5f55\uff0c\u9700\u8981\u5b89\u88c5\u7684\u6269\u5c55\u81ea\u884c\u589e\u51cf\uff0c\u7136\u540e\u8fdb\u884c\u7f16\u8bd1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">.\/configure --prefix=\/usr\/local\/php --with-config-file-path=\/usr\/local\/php\/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-zip --disable-fileinfo<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">\u8fdb\u884cmake\u65f6\u4f1a\u63d0\u793a\u9519\u8bef\uff1a\ncollect2: error: ld returned 1 exit status\nmake: *** [sapi\/cli\/php] Error 1\n<\/code><\/pre>\n\n\n\n<p>\u9700\u8981\uff1amake ZEND_EXTRA_LIBS=&#8217;-liconv&#8217;   \u8fdb\u884c\u7f16\u8bd1\u64cd\u4f5c<\/p>\n\n\n\n<p>\u7b49\u7f16\u8bd1\u540emake install\u5b89\u88c5\u5b8c\u6210\uff01<\/p>\n\n\n\n<p>\u628aphp-fpm\u505a\u6210\u7cfb\u7edf\u542f\u52a8\uff0c\u5148\u590d\u5236 php-7.4.9\u76ee\u5f55\u4e0b.\/sapi\/fpm\/init.d.php-fpm\u81f3\/etc\/init.d\/\u76ee\u5f55\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">cp .\/sapi\/fpm\/init.d.php-fpm \/etc\/init.d\/php-fpm<\/code><\/pre>\n\n\n\n<p>\u590d\u5236\u5b8c\uff0c\u6267\u884cservice php-fpm start \u4f1a\u63d0\u793a\u9519\u8bef\uff1aenv: \/etc\/init.d\/php-fpm: Permission denied\uff0c\u56e0\u4e3a init.d\u76ee\u5f55\u4e0b\u9700\u8981\u7ed9\u76f8\u5e94\u7684\u6743\u9650\u624d\u53ef\u6267\u884c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">chmod a+x \/etc\/init.d\/php-fpm<\/code><\/pre>\n\n\n\n<p>\u6267\u884cservice php-fpm start \u63d0\u793a\uff1aStarting php-fpm done \u8bf4\u660e\u542f\u52a8\u6210\u529f\uff01<\/p>\n\n\n\n<p>\u7136\u540e\u7b2c\u4e8c\u6b65\u5b89\u88c5Redis\u6269\u5c55\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"https:\/\/pecl.php.net\/package\/redis\" data-type=\"URL\" data-id=\"https:\/\/pecl.php.net\/package\/redis\">https:\/\/pecl.php.net\/package\/redis<\/a> \u9009\u62e9\u81ea\u5df1\u9002\u5408\u7684\u6269\u5c55\uff0c\u6211\u9009\u62e9\u4e86\u6700\u65b0\u7684Redis5.3.1\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">wget https:\/\/pecl.php.net\/get\/redis-5.3.1.tgz\ntar zxvf redis-5.3.1.tgz\ncd redis-5.3.1\nphpize\n.\/configure --with-php-config=\/usr\/local\/php\/bin\/php-config\nmake\nmake install<\/code><\/pre>\n\n\n\n<p>&#8211;with-php-config=\/usr\/local\/php\/bin\/php-config  \u6839\u636e\u81ea\u5df1\u5b89\u88c5\u7684\u4f4d\u7f6e\u627e\u5230php-config<\/p>\n\n\n\n<p>\u7f16\u8f91php.ini\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">vim \/usr\/local\/php\/etc\/php.ini<\/code><\/pre>\n\n\n\n<p>\u627e\u5230extension\u533a\u57df\uff0c\u589e\u52a0\uff1aextension=redis.so\uff0c\u7136\u540e\u4fdd\u5b58\u9000\u51fa<\/p>\n\n\n\n<p> \u91cd\u542fphp\u8fdb\u7a0b service php-fpm restart<\/p>\n\n\n\n<p>\u67e5\u770bphp\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86redis\u6a21\u5757\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@localhost php-7.4.9]# php -m\n[PHP Modules]\nbcmath\nCore\nctype\ncurl\ndate\ndom\nfilter\ngettext\nhash\niconv\njson\nlibxml\nmbstring\nmysqli\nmysqlnd\nopenssl\npcntl\npcre\nPDO\npdo_mysql\npdo_sqlite\nPhar\nposix\nredis\nReflection\nsession\nshmop\nSimpleXML\nsoap\nsockets\nSPL\nsqlite3\nstandard\nsysvsem\ntokenizer\nxml\nxmlreader\nxmlrpc\nxmlwriter\nxsl\nzlib\n\n[Zend Modules]<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7279\u522b\u6ce8\u610f\uff1a&#8211;with-config-file-path=\/usr\/local\/php\/etc\u7f16\u8bd1PHP\u662f\u6307\u5b9a\u76ee\u5f55 php.ini\u6587\u4ef6\uff0c\u5982\u679c\u975e\u6b64\u76ee\u5f55\u7684php.ini\u6587\u4ef6\u589e\u52a0\u6269\u5c55\uff0c\u91cd\u542f\u662f\u4e0d\u4f1a\u52a0\u8f7d\u6269\u5c55\u3002\u65b0\u624b\u8981\u7279\u522b\u6ce8\u610f\uff01\uff01\uff01<\/p>\n\n\n\n<p>\u5199\u4e00\u4e2aphp\u6587\u4ef6\uff1aphpinfo.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n  phpinfo();\n?><\/code><\/pre>\n\n\n\n<p>\u627e\u5230\u6b64\u914d\u7f6e\u4fe1\u606f\u9879\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Configuration File (php.ini) Path<\/td><td>\/usr\/local\/php\/etc<\/td><\/tr><tr><td>Loaded Configuration File<\/td><td>\/usr\/local\/php\/etc\/php.ini<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u53ea\u8bb2php\u7684\u7f16\u8bd1\u53caRedis\u6269\u5c55\u7684\u5b89\u88c5\uff0c\u5176\u4ed6n&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.kiccleaf.com\/?p=607\">Continue reading<span class=\"screen-reader-text\">Centos7\u5b89\u88c5php7.4.9+redis\u6269\u5c55<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":5,"footnotes":""},"categories":[4],"tags":[13,33,34,115,114],"class_list":{"0":"post-607","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-linux-","7":"tag-linux","8":"tag-php","9":"tag-php-x64","11":"tag-redis","12":"entry"},"views":2099,"_links":{"self":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=607"}],"version-history":[{"count":8,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":715,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions\/715"}],"wp:attachment":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}