﻿{"id":69,"date":"2009-06-30T11:15:50","date_gmt":"2009-06-30T11:15:50","guid":{"rendered":""},"modified":"2011-11-18T16:55:17","modified_gmt":"2011-11-18T08:55:17","slug":"69","status":"publish","type":"post","link":"http:\/\/zerobox.org\/notes\/69.html","title":{"rendered":"apache\u7684\u9759\u6001\/\u52a8\u6001\u7f16\u8bd1\u5728apache+php+mysql\u7684\u5e94\u7528"},"content":{"rendered":"<p>apache\u7684\u9759\u6001\/\u52a8\u6001\u7f16\u8bd1\u5728apache+php+mysql\u7684\u5e94\u7528<\/p>\n<p>\u6211\u60f3\u5927\u5bb6\u6709\u4e0d\u5c11\u90fd\u6210\u529f\u5b9e\u73b0apache+php+mysql\uff0c\u7f51\u4e0a\u7684\u6587\u7ae0\u4e5f\u6709\u4e0d\u5c11\uff0c\u4f46\u6211\u53d1\u73b0\u4e0d\u5c11\u6587\u7ae0\u90fd\u662f\u6284\u6765\u6284\u53bb\uff0c\u5e76\u4e14<\/p>\n<p>\u6ca1\u6709\u8bf4\u660e\u767d\u7f16\u8bd1\u7684\u65b9\u5f0f\uff0c\u6709\u7684\u7d22\u6027apache1.3\u7684\u7f16\u8bd1\u65b9\u6cd5\u539f\u5c01\u4e0d\u52a8\u7684\u642c\u8fc7\u6765\u5957\u5728apache2.0\uff0c\u663e\u7136\u8bef\u5bfc\u4e00\u4e9b\u83dc\u9e1f<\/p>\n<p>\uff01<\/p>\n<p>\u6211\u4eca\u5929\u5c31\u4ee5apache+mysql+php\u8bf4\u4e00\u4e0b\u9759\u6001\u7f16\u8bd1\u548cDSO\u52a8\u6001\u7f16\u8bd1\u7684\u533a\u522b\uff0c\u6211\u4f1a\u5206\u522b\u62ffapache1.3.27\u548capache2.0.46<\/p>\n<p>\u8bf4\u660e\uff0c\u56e0\u4e3a\u4e24\u4e2a\u7248\u672c\u7684\u7f16\u8bd1\u547d\u4ee4\u662f\u6709\u6240\u533a\u522b\u7684\u3002<\/p>\n<p>\u7cfb\u7edf\u548c\u6240\u9700\u8f6f\u4ef6\uff1a<br \/>\nRedhat9.0<br \/>\napache:1.3.27 \u548c 2.0.46<br \/>\nphp: 4.3.2<br \/>\nmysql\uff1a4.0.13<\/p>\n<p>1\u3002\u9996\u5148\u6765\u5b89\u88c5mysql\uff0c\u8fd9\u4e0d\u662f\u6211\u4eec\u7684\u91cd\u70b9\uff0c\u6240\u4ee5\u5173\u4e8emysql\u7684\u5b89\u88c5\u914d\u7f6e\u6211\u5c31\u5f88\u5feb\u8fc7\u53bb\u4e86<\/p>\n<p>tar zvxf mysql-4.0.13.tar.gz<br \/>\ncd mysql-4.0.13<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/mysql &#8211;sysconfdir=\/etc &#8211;localstatedir=\/var\/lib\/mysql &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\uff01<\/p>\n<p>\u7136\u540e\u521d\u59cb\u5316\u6570\u636e\u5e93<\/p>\n<p>\/usr\/local\/mysql\/bin\/mysql_install_db<\/p>\n<p>\u8bbe\u7f6e\u6743\u9650\uff1a<\/p>\n<p>chown -R root \/usr\/local\/mysql<\/p>\n<p>\u590d\u5236\u914d\u7f6e\u6587\u4ef6;<\/p>\n<p>cp \/usr\/local\/mysql\/share\/mysql\/my-medium.cnf \/etc\/my.cnf<\/p>\n<p>\u542f\u52a8mysql\uff1a<\/p>\n<p>\/use\/local\/mysql\/bin\/mysqld_safe &#8211;user=root &amp;<\/p>\n<p>\u4fee\u6539\u5bc6\u7801\uff1a\u521d\u59cb\u7684root\u5bc6\u7801\u662f\u7a7a\u7684<\/p>\n<p>\/usr\/local\/mysql\/bin\/mysqladmin -u root -p password 1234<br \/>\nenter password:<\/p>\n<p>\u628a\u5bc6\u7801\u4fee\u6539\u4e3a1234\uff0c\u7531\u4e8e\u521d\u59cb\u5bc6\u7801\u4e3a\u7a7a\uff0c\u6240\u4ee5enter password\u76f4\u63a5\u56de\u8f66\u5c31\u884c<\/p>\n<p>\u6d4b\u8bd5\u4e00\u4e0b\u65b0\u7684\u5bc6\u7801\uff1a<\/p>\n<p>mysql -u root -p mysql<br \/>\nenter password:1234<\/p>\n<p>\u5982\u679c\u987a\u5229\u7684\u8bdd\u5c31\u80fd\u8fdb\u5165mysql\u3002<\/p>\n<p>\u597d\u4e86mysql\u5c31\u8bb2\u8fd9\u4e48\u591a\uff0c\u6709\u4ec0\u4e48\u95ee\u9898\u4e5f\u4e0d\u8981\u95ee\u6211\uff0c\u6211\u5bf9mysql\u4e0d\u662f\u5f88\u719f\u6089\u3002<\/p>\n<p>\u597d\u4e86\u4e0b\u9762\u662f\u6211\u4eec\u7684\u91cd\u5934\u620f\uff0c\u6211\u5c06\u5206\u522b\u901a\u8fc7\u9759\u6001\u548c\u52a8\u6001DSO\u7f16\u8bd1apache+php<\/p>\n<p>\u81f3\u4e8e\u4ec0\u4e48\u662f\u9759\u6001\uff0c\u4ec0\u4e48\u662fDSO\u52a8\u6001\u6211\u8fd9\u91cc\u5c31\u4e0d\u591a\u8bb2\u4e86\uff0c\u672c\u4eba\u4e2a\u4eba\u503e\u5411\u5927\u5bb6\u7528DSO\u52a8\u6001\u7f16\u8bd1\u3002<\/p>\n<p>\u9996\u5148\u662fapache1.3.29+php4.3.4+mysql4.0.13\u7684\u9759\u6001\u7f16\u8bd1<\/p>\n<p>apache\u7b2c\u4e00\u6b21\u7f16\u8bd1,\u5e76\u4e0d\u8981\u5b89\u88c5\uff0c\u56e0\u4e3aphp\u7684\u7f16\u8bd1\u9700\u8981apache\u81f3\u5c11\u5df2\u7ecf\u7f16\u8bd1\u8fc7\u4e00\u6b21<br \/>\ntar zvxf apache_1.3.27.tar.gz<br \/>\ncd apache_1.3.27<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/apache<\/p>\n<p>\u7f16\u8bd1php<\/p>\n<p>tar zvxf php4.3.4.tar.gz<br \/>\ncd php4.3.4<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/php &#8211;with-mysql=\/usr\/local\/mysql<br \/>\n&#8211;with-apache=..\/apache_1.3.27 &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>\u7b2c\u4e8c\u6b21\u7f16\u8bd1\u5b89\u88c5apache:<br \/>\ncd ..\/apache_1.3.29<br \/>\n.\/configure &#8211;prefi=\/usr\/local\/apache<br \/>\n&#8211;activate-module=src\/modules\/php4\/libphp4.a &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>cp ..\/php4.3.4\/php.ini.dist \/usr\/local\/php\/lib\/php.ini<\/p>\n<p>\u4fee\u6539\/usr\/local\/apache\/conf\/httpd.conf<\/p>\n<p>\u67e5\u627e&lt;IfModule mod_mime.c&gt;<\/p>\n<p>\u5728\u6b64\u8303\u56f4\u6dfb\u52a0<\/p>\n<p>AddType application\/x-httpd-php .php<br \/>\nAddType application\/x-httpd-php-source .phps<\/p>\n<p>\u6ce8\u610f\uff1aapache\u548cphp\u7684\u6e90\u7801\u5305\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\uff0c&#8211;with-apache=..\/apache_1.3.27\u662f\u6307\u5411\u6e90\u7801\u89e3\u538b\u7684\u76ee\u5f55<\/p>\n<p>ok!\u9759\u6001\u7f16\u8bd1\u5b8c\u6210\uff0c\u5927\u5bb6\u53ea\u8981\u542f\u52a8\u4e00\u4e0b\u670d\u52a1\u5668<br \/>\n\/usr\/local\/apache\/bin\/apachectl start<\/p>\n<p>\u7136\u540e\u4e9b\u4e2aphp\u6d4b\u8bd5\u9875info.php:\u5185\u5bb9\u5982\u4e0b<\/p>\n<p>&lt;?php<br \/>\nphpinfo();<br \/>\n?&gt;<\/p>\n<p>\u6b63\u5e38\u7684\u8bdd\uff0c\u5e94\u8be5\u80fd\u770b\u5230php\u7684\u4fe1\u606f\u4e86\uff0c\u606d\u559c\u4f60\u9759\u6001\u7f16\u8bd1\u6210\u529f\uff01\uff01\uff01<\/p>\n<p>\u6211\u4eec\u518d\u6765\u8bb2\u8bb2DSO\u52a8\u6001\u7f16\u8bd1\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>\u9996\u5148\u7f16\u8bd1\u5b89\u88c5apache<\/p>\n<p>tar zvxf apache_1.3.29<br \/>\ncd apache_1.3.29<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/apache &#8211;enable-module=so<br \/>\n&#8211;enable-module=rewrite &#8211;enable-shared=max &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>so\u6a21\u5757\u7528\u6765\u63d0\u4f9bDSO\u652f\u6301\u7684apachehe\u6838\u5fc3\u6a21\u5757\uff0crewrite\u662f\u5730\u5740\u91cd\u5199\u7684\u6a21\u5757\uff0c\u5982\u679c\u4e0d\u9700\u8981\u53ef\u4ee5\u4e0d\u7f16\u8bd1<br \/>\nenable\uff0dshared\uff1dmax\u662f\u6307\u9664\u4e86so\u4ee5\u5916\u7684\u6240\u6709\u6807\u51c6\u6a21\u5757\u90fd\u7f16\u8bd1\u6210DSO\u6a21\u5757\u3002<\/p>\n<p>\u7136\u540e\u7f16\u8bd1php<\/p>\n<p>tar zvxf php4.3.4.tar.gz<br \/>\ncd php4.3.2<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/php &#8211;with-mysql=\/usr\/local\/mysql<br \/>\n&#8211;with-apxs=\/usr\/local\/apache\/bin\/apxs &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>\u7136\u540e\u4fee\u6539httpd.conf\uff0c\u65b9\u6cd5\u540c\u9759\u6001\u7f16\u8bd1\u7684\u65b9\u6cd5<\/p>\n<p>OK\uff0cDSO\u52a8\u6001\u7f16\u8bd1\u5c31\u5b8c\u6210\u4e86\uff0c\u5927\u5bb6\u5e94\u8be5\u770b\u51fa\u660e\u5802\u6765\u4e86\u5427\uff0c\u4e2d\u95f4\u6709\u4ec0\u4e48\u533a\u522b\u5e94\u8be5\u770b\u7684\u5f88\u6e05\u695a\u4e86\u5427\uff01\uff01\uff01<\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u8bb2apache2.0.46+php4.3.2\u7684\u7f16\u8bd1\u65b9\u6cd5\uff0c\u6211\u8fd9\u91cc\u53ea\u8bb2DSO\u52a8\u6001\u7f16\u8bd1\uff0c\u9759\u6001\u7f16\u8bd1\u5b9e\u5728\u6ca1\u6709\u65f6\u95f4\u6d4b\u8bd5\u4e86\uff0c<\/p>\n<p>\u7559\u7ed9\u5927\u5bb6\u81ea\u5df1\u53bb\u8bd5\u4e86\u3002<\/p>\n<p>\u4e00\u6837\u73b0\u7f16\u8bd1\u5b89\u88c5apache<\/p>\n<p>tar zvxf httpd-2.0.46.tar.gz<\/p>\n<p>cd httpd-2.0.46<\/p>\n<p>.\/configure &#8211;prefix=\/usr\/local\/apache2 &#8211;enable-so<br \/>\n&#8211;enable-mods-shared=most &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>\u5927\u5bb6\u6ce8\u610f\u4e86&#8211;enable-so\u76f8\u5f53\u4e0e1.3.27\u7684&#8211;enable-module=so\uff0c\u800c&#8211;enable-mods-shared=most\u53c8\u7b49\u540c\u4e0e\u4ee5\u524d\u7684<br \/>\n&#8211;enable-shared=max \u8fd9\u4e9b\u533a\u522b\u5927\u5bb6\u8981\u6ce8\u610f\u4e86\uff0c\u5426\u5219\u7f16\u8bd1\u9519\u4e86\u4e0d\u8981\u627e\u6211<\/p>\n<p>\u7136\u540e\u8fd8\u662f\u7f16\u8bd1PHP<\/p>\n<p>tar zvxf php4.3.2.tar.gz<\/p>\n<p>.\/configure &#8211;prefix=\/usr\/local\/php &#8211;with-mysql=\/usr\/local\/mysql<br \/>\n&#8211;with-apxs2=\/usr\/local\/apache2\/bin\/apxs &amp;&amp;<br \/>\nmake &amp;&amp;<br \/>\nmake install<\/p>\n<p>\u6ce8\u610f\u8fd9\u91cc\u662fapxs2\uff01\uff01\uff01<\/p>\n<p>\u4fee\u6539httpd.conf\u4e0e1.3.27\u4e5f\u6709\u6240\u4e0d\u540c\uff0c\u5927\u5bb6\u5bfb\u627eAdd Type application\/x-tar .tgz \u5728\u4e0b\u9762\u6dfb\u52a0<\/p>\n<p>AddType application\/x-httpd-php .php<br \/>\nAddType application\/x-httpd-php-source .phps<\/p>\n<p>\u53e6\u5916\u8981\u663e\u793a\u4e2d\u6587\u7684\u8bdd\uff0c<br \/>\n\u4fee\u6539:<\/p>\n<p>AddDefaultCharset gb2312<\/p>\n<p>\u542f\u52a8\u4e00\u4e0bapache<\/p>\n<p>\/usr\/local\/apache2\/bin\/apachectl start<\/p>\n<p>\u7528\u90a3\u4e2ainfo.php\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u5e94\u8be5\u4e0d\u4f1a\u6709\u591a\u5927\u95ee\u9898\u54e6\uff01\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>apache\u7684\u9759\u6001\/\u52a8\u6001\u7f16\u8bd1\u5728apache+php+mysql\u7684\u5e94\u7528 \u6211\u60f3\u5927\u5bb6\u6709 &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/zerobox.org\/notes\/69.html\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[97,99,56],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","tag-apache","tag-mysql","tag-php"],"views":747,"_links":{"self":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":0,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"wp:attachment":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}