{"id":1270,"date":"2012-01-07T23:56:11","date_gmt":"2012-01-07T15:56:11","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1270"},"modified":"2012-01-07T23:57:35","modified_gmt":"2012-01-07T15:57:35","slug":"nginx-php-fpm-phpize","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/linux\/nginx-php-fpm-phpize.html","title":{"rendered":"YUM\u5b89\u88c5Nginx\u5e76\u7f16\u8bd1\u5b89\u88c5PHP5.3.8 with PHP-FPM"},"content":{"rendered":"
\u4e00\u3001Nginx\u5b89\u88c5<\/strong><\/p>\n \u5b89\u88c5Nginx\u53ef\u4ee5\u91c7\u7528YUM\u65b9\u6cd5\uff0cNginx\u5b98\u65b9\u63d0\u4f9b\u7684\u6e90\u53ef\u4ee5\u4fdd\u8bc1\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u7a33\u5b9a\u7a0b\u5e8f<\/p>\n vim \/etc\/yum.repos.d\/CentOS-Base.repo \u6dfb\u52a0\u4ee5\u4e0bYUM\u6e90\u4fe1\u606f<\/p>\n [nginx]<\/p>\n name=nginx repo<\/p>\n baseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/$basearch\/<\/p>\n gpgcheck=0<\/p>\n enabled=1<\/p><\/blockquote>\n \u66f4\u65b0YUM\u7f13\u5b58<\/p>\n yum makecache<\/p><\/blockquote>\n \u5b89\u88c5Nginx<\/p>\n yum install nginx<\/p><\/blockquote>\n \u63a7\u5236Nginx\u8fd0\u884c\uff1a<\/p>\n \u901a\u8fc7YUM\u5b89\u88c5\u5b8c\u6bd5Nginx\u540e\u53ef\u4ee5\u4f7f\u7528service\u547d\u4ee4\u7ba1\u7406\uff0c\u76ee\u524d\u652f\u6301\u4ee5\u4e0b\u53c2\u6570<\/p>\n service nginx {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest}<\/p><\/blockquote>\n \u4e8c\u3001\u7f16\u8bd1\u5b89\u88c5PHP5.3.8 with PHP-FPM<\/strong><\/p>\n PHP\u9700\u8981\u7f16\u8f91\u5b89\u88c5\uff0cYUM\u81ea\u5e26\u6e90\u7248\u672c\u6bd4\u8f83\u4f4e\uff0c\u6211\u4eec\u53ef\u4ee5\u7f16\u8bd1\u5b89\u88c5\u6700\u65b0\u7248PHP\uff0c\u4ecePHP5.3\u5f00\u59cb\u5b98\u65b9\u5df2\u7ecf\u81ea\u5e26PHP-FPM\u529f\u80fd\uff0c\u5b89\u88c5\u7684\u65f6\u5019\u5e26\u4e0a\u53c2\u6570 “–enable-fpm”\u5373\u53ef<\/p>\n \/php.5.3\u6e90\u6587\u4ef6\u76ee\u5f55\/\u4e0b\u6267\u884c<\/p>\n .\/configure –enable-fpm<\/p>\n make<\/p>\n make install<\/p><\/blockquote>\n \u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u63d0\u793a\u627e\u4e0d\u5230libxml2\u5b89\u88c5\u4f4d\u7f6e\uff0c\u9700\u8981\u5148\u7f16\u8bd1\u5b89\u88c5libxml2\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/span><\/p>\n yum install libxml2<\/p>\n yum install libxml2-devel<\/p><\/blockquote>\n \u91cd\u542fPHP-FPM<\/strong><\/p>\n php5.3.8 \u7684PHP-FPM\u4e0d\u518d\u652f\u6301php-fpm \u8865\u4e01\u5177\u6709\u7684 \/usr\/local\/php\/sbin\/php-fpm (start|stop|reload)\u7b49\u547d\u4ee4\uff0c\u9700\u8981\u4f7f\u7528\u4fe1\u53f7\u63a7\u5236\uff1a<\/p>\n INT, TERM \u00a0 \u00a0\u7acb\u523b\u7ec8\u6b62<\/p>\n QUIT \u00a0 \u00a0\u5e73\u6ed1\u7ec8\u6b62<\/p>\n USR1 \u00a0 \u00a0\u91cd\u65b0\u6253\u5f00\u65e5\u5fd7\u6587\u4ef6<\/p>\n USR2 \u00a0 \u00a0\u5e73\u6ed1\u91cd\u8f7d\u6240\u6709worker\u8fdb\u7a0b\u5e76\u91cd\u65b0\u8f7d\u5165\u914d\u7f6e\u548c\u4e8c\u8fdb\u5236\u6a21\u5757<\/p>\n \u5e73\u6ed1\u91cd\u542f\uff1a kill -USR2 `cat \/var\/run\/php-fpm.pid`<\/p><\/blockquote>\n \u4e09\u3001\u4e3aPHP\u7f16\u8bd1\u6dfb\u52a0\u65b0\u6a21\u5757<\/strong><\/p>\n \u7f16\u8bd1php\u7684\u65f6\u5019\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4 “.\/configure –with-libxxx”\u6765\u7f16\u8bd1\u5b89\u88c5\u76f8\u5173\u6a21\u5757\uff0c\u5b89\u88c5\u5b8c\u6bd5\u540e\u5982\u679c\u8fd8\u9700\u8981\u6dfb\u52a0\u6a21\u5757\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b8c\u6210\u6a21\u5757\u6dfb\u52a0\uff0c\u6211\u4eec\u4ee5\u6dfb\u52a0curl\u6a21\u5757\u4e3a\u4f8b\uff1a<\/p>\n #cd \/PHP\u6e90\u6587\u4ef6\u76ee\u5f55\/ext\/curl<\/p>\n #phpize (\u4e3a\u91cd\u65b0\u7f16\u8bd1\u65b0\u6a21\u5757\u51c6\u5907PHP\u73af\u5883\u53c2\u6570)<\/p>\n #.\/configure –with-php-config=\/php.ini\u6587\u4ef6\u8def\u5f84\/(\u6839\u636e\u5f53\u524dphp.ini\u73af\u5883\u7f16\u8bd1\u751f\u6210\u6a21\u5757\uff0c\u53ef\u7565)<\/p>\n #make (\u6b64\u6b65\u5c06\u5728 \/PHP\u6e90\u6587\u4ef6\u76ee\u5f55\/ext\/curl\/module\/\u76ee\u5f55\u4e0b\u9762\u751f\u6210curl.so\u6587\u4ef6)<\/p>\n #cp\u00a0\/PHP\u6e90\u6587\u4ef6\u76ee\u5f55\/ext\/curl\/module\/curl.so \/php\u7684extension\u76ee\u5f55\u4e0b\/<\/p>\n #vim php.ini \u6dfb\u52a0 extension=curl.so<\/p>\n php-fpm\u91cd\u65b0\u52a0\u8f7dphp.ini\u5373\u53ef\u751f\u6548<\/p><\/blockquote>\n Q&A<\/strong><\/p>\n #cp \/php\u6e90\u6587\u4ef6\u76ee\u5f55\/php.ini-production \/usr\/local\/lib\/php.ini<\/p><\/blockquote>\n<\/li>\n \u4e00\u3001Nginx\u5b89\u88c5 \u5b89\u88c5Nginx\u53ef\u4ee5\u91c7\u7528YUM\u65b9\u6cd5\uff0cNginx\u5b98\u65b9\u63d0\u4f9b\u7684\u6e90\u53ef\u4ee5\u4fdd\u8bc1\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u7a33\u5b9a\u7a0b\u5e8f v […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,9],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1270"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1270"}],"version-history":[{"count":8,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1270\/revisions"}],"predecessor-version":[{"id":1278,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1270\/revisions\/1278"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
\n
\n\u901a\u5e38404\u9519\u8bef\u662f\u7531php-fpm\u6267\u884c\u6587\u4ef6\u8def\u5f84\u9519\u8bef\uff0c\u8bf7\u786e\u8ba4\u662f\u5426\u6b63\u786e\u8bbe\u7f6e \u201cSCRIPT_FILENAME\u201d\u53c2\u6570\uff0c\u8bf7\u4fee\u6539”\/etc\/nginx\/conf.d\/default.conf”\u4e2d\u53c2\u6570\uff1a<\/p>\nfastcgi_param SCRIPT_FILENAME \/scripts$fastcgi_script_name;\r\n\u6539\u4e3a\r\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n\r\nlocation \u7684 root\u8bbe\u7f6e\u4e3a\u7edd\u5bf9\u8def\u5f84<\/span><\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"