﻿{"id":157,"date":"2013-10-21T17:06:42","date_gmt":"2013-10-21T09:06:42","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=157"},"modified":"2013-10-22T11:03:48","modified_gmt":"2013-10-22T03:03:48","slug":"linux%e4%b8%8bapache2-2-4php5-5-5%e6%90%ad%e5%bb%ba","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=157","title":{"rendered":"Linux\u4e0bapache2.2.4+php5.5.5\u642d\u5efa"},"content":{"rendered":"<h1>\u7248\u672c\u00a0<wbr \/><\/h1>\n<p>CentOS\u00a0<wbr \/>6.4\u00a0<wbr \/>\u00a0\/\/\u6700\u5c0f\u5b89\u88c5;\u8981\u89e3\u51b3\u5f88\u591a\u4f9d\u8d56\u5305\u5efa\u8baeyum\u8fdb\u884c\u5b89\u88c5<\/p>\n<p>httpd-2.4.6.tar.gz<\/p>\n<p>php-5.5.5.tar.gz<\/p>\n<p>&nbsp;<\/p>\n<h1>\u6b65\u9aa4\uff1a<\/h1>\n<p>1)\u00a0<wbr \/>\u5b89\u88c5\u6240\u9700\u8981\u7684\u4e00\u4e9b\u5e93\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/><\/p>\n<p>\/\/\u53ef\u4ee5\u76f4\u63a5\u8fdb\u5165\u7b2c\u4e8c\u6b65\uff0c\u5b89\u88c5\u65f6\u51fa\u73b0\u6240\u9700\u5e93\u672a\u5b89\u88c5\u8fd4\u56de\u7b2c\u4e00\u6b65<\/p>\n<p>2)\u00a0<wbr \/>\u5b89\u88c5apache<\/p>\n<p>3)\u00a0<wbr \/>\u5b89\u88c5php<\/p>\n<p>4)\u00a0<wbr \/>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>5)\u00a0<wbr \/>\u6d4b\u8bd5<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4e00\uff1a\u5b89\u88c5\u5e93<\/h1>\n<p>\u5b89\u88c5\u65f6\u53ef\u80fd\u51fa\u73b0\u4e00\u4e9b\u8f6f\u4ef6\u5305\u672a\u5b89\u88c5\u00a0<wbr \/>\u6bd4\u5982\uff1aAPR\u00a0<wbr \/>APR-util\u00a0<wbr \/>PCRE\u00a0<wbr \/>\u00a0<wbr \/>C++\u00a0<wbr \/>\u6216\u5176\u4ed6\u5e93<\/p>\n<p><wbr \/><\/p>\n<p>\u5b89\u88c5\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>\u2460\u3000yum\u00a0<wbr \/>\u00a0<wbr \/>\u5b89\u88c5\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\/\/yum\u00a0<wbr \/>install\u00a0<wbr \/>-y\u00a0<wbr \/>\u5305\u540d<\/p>\n<p>\u2461\u3000tar\u00a0<wbr \/>\u00a0<wbr \/>\u5b89\u88c5\u00a0<wbr \/>\u5982\u4e0b<\/p>\n<p>tar\u00a0<wbr \/>zxvf\u00a0<wbr \/>\u00a0<wbr \/>apr-1.4.8.tar.gz\u00a0<wbr \/><\/p>\n<p>cd\u00a0<wbr \/>apr-1.4.8<\/p>\n<p>.\/configure\u00a0<wbr \/>&#8211;prefix=\/usr\/local\/apr\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\/\/\u6ce8\u610f\u8def\u5f84\u00a0<wbr \/>\u5b89\u88c5httpd\u65f6\u514d\u5f97\u627e\u4e0d\u5230<\/p>\n<p>make<\/p>\n<p>make\u00a0<wbr \/>install<\/p>\n<p><wbr \/><\/p>\n<p>tar\u00a0<wbr \/>zxvf\u00a0<wbr \/>apr-util-1.5.2.tar.gz\u00a0<wbr \/><\/p>\n<p>cd\u00a0<wbr \/>apr-util-1.5.2<\/p>\n<p>.\/configure\u00a0<wbr \/>&#8211;prefix=\/usr\/local\/apr-util\u00a0<wbr \/>&#8211;with-apr=\/usr\/local\/apr<\/p>\n<p>make<\/p>\n<p>make\u00a0<wbr \/>install<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/><\/p>\n<p>yum\u00a0<wbr \/>install\u00a0<wbr \/>-y\u00a0<wbr \/>gcc\u00a0<wbr \/>gcc-c++<\/p>\n<p><wbr \/><\/p>\n<p>tar\u00a0<wbr \/>zxvf\u00a0<wbr \/>pcre-8.33.tar.gz\u00a0<wbr \/><\/p>\n<p>cd\u00a0<wbr \/>pcre-8.33<\/p>\n<p>.\/configure\u00a0<wbr \/>&#8211;prefix=\/usr\/local\/pcre<\/p>\n<p>make<\/p>\n<p>make\u00a0<wbr \/>install<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4e8c\uff1a\u5b89\u88c5apache<\/h1>\n<p>tar\u00a0<wbr \/>zxvf\u00a0<wbr \/>\u00a0httpd-2.4.6.tar.gz\u00a0\u00a0<wbr \/>\u00a0<wbr \/><\/p>\n<p>cd\u00a0<wbr \/>httpd-2.4.6<\/p>\n<p>.\/configure\u00a0<wbr \/>&#8211;prefix=\/usr\/local\/httpd\u00a0<wbr \/>&#8211;with-apr=\/usr\/local\/apr\u00a0<wbr \/>&#8211;with-apr-util=\/usr\/local\/apr-util\u00a0<wbr \/>&#8211;enable-module=so\u00a0<wbr \/>&#8211;with-pcre=\/usr\/local\/pcre<\/p>\n<p>make<\/p>\n<p>make\u00a0<wbr \/>install<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4e09\uff1a\u5b89\u88c5PHP<\/h1>\n<p>tar\u00a0<wbr \/>zxvf\u00a0<wbr \/>php-5.5.5.tar.gz<\/p>\n<p>cd\u00a0<wbr \/>php-5.5.5<\/p>\n<p>.\/configure\u00a0<wbr \/>\u00a0<wbr \/>&#8211;with-apxs2=\/usr\/local\/apache\/bin\/apxs\u00a0<wbr \/>\u00a0<wbr \/>&#8211;prefix=\/usr\/local\/php\u00a0&#8211;with-config-file-path=\/usr\/local\/php\u00a0\u00a0&#8211;with-mysql=mysqlnd<\/p>\n<p>make<\/p>\n<p>make\u00a0<wbr \/>install<\/p>\n<p>&nbsp;<\/p>\n<h1>\u56db\uff1a\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/h1>\n<p>Apache<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u5728\/usr\/local\/httpd\/conf\/httpd.conf<\/p>\n<p>\u7f51\u9875\u6587\u4ef6\u5728\/usr\/local\/httpd\/htdocs\/<\/p>\n<p>php\u00a0<wbr \/><\/p>\n<p><wbr \/>\u00a0\u00a0<wbr \/>\u00a0<wbr \/>\u914d\u7f6e\u6587\u4ef6\u5728\u00a0<wbr \/>\/etc\/php.ini<\/p>\n<p><wbr \/><\/p>\n<p>cp\u00a0<wbr \/>\/xxx(php\u5b89\u88c5\u6587\u4ef6\u7684\u76ee\u5f55)\/php.ini-development\u00a0<wbr \/>\u00a0<wbr \/>\/etc\/php\/ini<\/p>\n<p><wbr \/><\/p>\n<p>vi\u00a0<wbr \/>\u00a0<wbr \/>\/usr\/local\/httpd\/conf\/httpd.conf<\/p>\n<p>\u786e\u4fdd\u4ee5\u4e0b\u5b57\u7b26\u4e32\u662f\u5426\u5b58\u5728<\/p>\n<p>LoadModule php5_module modules\/libphp5.so<\/p>\n<p>\u5728&lt;IfModule&gt;&#8230;&lt;\/IfModule&gt;\u4e4b\u95f4\u6dfb\u52a0\u00a0AddType\u00a0<wbr \/>application\/x-httpd-php\u00a0<wbr \/>.php\u00a0<wbr \/>.phtml\u00a0<wbr \/>.php3\u00a0<wbr \/>.inc<\/p>\n<p>\u5728\/usr\/local\/apache\/htdocs\/ \u4e0b\u521b\u5efa\u4ee5\u4e0bphp\u6587\u4ef6\u8fdb\u884c\u6d4b\u8bd5<\/p>\n<p>&lt;?php<\/p>\n<p>phpinfo()<\/p>\n<p>?&gt;<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4e94\uff1a\u914d\u7f6e\u4e3a\u7cfb\u7edf\u670d\u52a1<\/h1>\n<p># cp \/usr\/local\/httpd\/bin\/apachectl \/etc\/rc.d\/init.d\/httpd<\/p>\n<p>\u7136\u540e vi \/etc\/rc.d\/init.d\/httpd \u6dfb\u52a0(# !\/bin\/sh\u4e0b\u9762)<\/p>\n<p># chkconfig: 2345 50 90<\/p>\n<p># description: Activates\/Deactivates Apache Web Server<\/p>\n<p>\u4fdd\u5b58\u9000\u51fa<\/p>\n<p>\u6700\u540e\uff0c\u8fd0\u884cchkconfig\u628aApache\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u542f\u52a8\u670d\u52a1\u7ec4\u91cc\u9762\uff1a<\/p>\n<p># chkconfig &#8211;add httpd<\/p>\n<p># chkconfig &#8211;level 2345 httpd on<\/p>\n<p>\u7136\u540e\u518dservice httpd start<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7248\u672c\u00a0 CentOS\u00a06.4\u00a0\u00a0\/\/\u6700\u5c0f\u5b89\u88c5;\u8981\u89e3\u51b3\u5f88\u591a\u4f9d\u8d56\u5305\u5efa\u8baeyum\u8fdb\u884c\u5b89\u88c5 &hellip; <a href=\"http:\/\/blog.sway.com.cn\/?p=157\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[236,70,23,234,53],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-apache","tag-apache","tag-apr","tag-centos","tag-linux","tag-php"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157"}],"version-history":[{"count":9,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":166,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions\/166"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}