{"id":49,"date":"2019-05-25T02:01:00","date_gmt":"2019-05-25T02:01:00","guid":{"rendered":"http:\/\/pro369.com\/linux\/?p=49"},"modified":"2019-05-25T02:01:00","modified_gmt":"2019-05-25T02:01:00","slug":"linux%2bapache%2bmysql%2bphp%e5%85%b8%e5%9e%8b%e9%85%8d%e7%bd%ae%ef%bc%88linux%e4%b8%bb%e6%a9%9f%e4%bc%ba%e6%9c%8d%e5%99%a8%e6%9e%b6%e8%a8%ad%e6%8a%80%e8%a1%93%ef%bc%89","status":"publish","type":"post","link":"https:\/\/por.tw\/linux\/linux%2bapache%2bmysql%2bphp%e5%85%b8%e5%9e%8b%e9%85%8d%e7%bd%ae%ef%bc%88linux%e4%b8%bb%e6%a9%9f%e4%bc%ba%e6%9c%8d%e5%99%a8%e6%9e%b6%e8%a8%ad%e6%8a%80%e8%a1%93%ef%bc%89\/","title":{"rendered":"Linux+Apache+Mysql+PHP\u5178\u578b\u914d\u7f6e\uff08Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff09"},"content":{"rendered":"<p><font size=\"3\" style=\"background-color: #ffff00\"><strong>Linux+Apache+Mysql+PHP\u5178\u578b\u914d\u7f6e\uff08Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff09<\/strong><\/font><\/p>\n<p> Linux\u7cfb\u7d71\u7684\u5b89\u88dd\u6211\u5c31\u4e0d\u8b1b\u4e86\uff0c\u9019\u662f\u57fa\u672c\u529f\uff0c\u5176\u5be6\u9019\u7bc7\u6587\u7ae0\u5728\u985e\u4f3cRedhat\u7684\u5176\u4ed6linux\u4e5f\u61c9\u8a72\u901a\u7528\uff0c\u5927\u5bb6\u53ea\u8981\u638c\u63e1\u6211\u63d0\u4f9b\u7684\u65b9\u6cd5\u5c31\u884c\u3002<br \/> \u8a18\u5f97\u5b89\u88dd Redhat9\u30020\u7684\u6642\u5019\u4e0d\u8981\u5b89\u88dd\u7cfb\u7d71\u9810\u8a2d\u7684apache\uff0cmysql\u548cphp\u4ee5\u53ca\u95dc\u806f\u7684\u8edf\u9ad4\u3002<br \/> \u5df2\u7d93\u5b89\u88dd\u7684\u8acb\u7528rpm -e * \u522a\u9664\u5df2\u7d93\u5b89\u88dd\u7684\u5305\u3002<\/p>\n<p> 1.\u5b89\u88ddMysql3.23.58<\/p>\n<p> \u5176\u5be6\u8001\u5be6\u8aaa\u76f4\u63a5\u5b89\u88ddMysql\u5b98\u65b9\u7db2\u7ad9\u63d0\u4f9b\u7684rpm\u5305\u4e5f\u662f\u4e00\u500b\u6bd4\u8f03\u53ef\u884c\u7684\u8fa6\u6cd5\uff0c\u4ed6\u7684\u5b98\u65b9\u7db2\u7ad9\u7684rpm\u5305\u7684\u63d0\u4f9b\u57fa\u672c\u8ddftar\u5305\u767c\u884c\u662f\u540c\u6b65\u7684\uff0c\u9019\u9ede\u6211\u6bd4\u8f03\u559c\u6b61\uff0c\u81f3\u5c11\u5b89\u88ddrpm\u5305\u7684\u5728\u5f8c\u9762\u7684\u9664\u932f\u4e2d\u4e0d\u6703\u51fa\u73femysql\u5eab\u6a94\u6848\u627e\u4e0d\u5230\u7684\u60c5\u6cc1\u3002\u4f46\u9019\u88e1\u9084\u662f\u6709\u5fc5\u8981\u8b1b\u4e00\u4e0b\u81ea\u8a02\u5b89\u88dd\u7684\u6b65\u9a5f\uff0c\u7562\u7adf\u7db2\u53cb\u81ea\u8a02\u5b89\u88dd\u7684\u9084\u8aaa\u633a\u591a\u7684\u3002<\/p>\n<p> \u8edf\u9ad4\u53d6\u5f97\uff1ahttp:\/\/www.mysql.com\/downloads\/index.html<\/p>\n<p> \u5b89\u88dd\u6b65\u9a5f\uff1a<\/p>\n<p> tar zxvf mysql-3.23.58.tar.gz<br \/> cd mysql-3.23.58<\/p>\n<p> .\/configure &#8211;prefix=\/usr\/local\/mysql &#8211;sysconfdir=\/etc &#8211;localstatedir=\/var\/lib\/mysql<\/p>\n<p> make<\/p>\n<p> make install<\/p>\n<p> #prefix=\/usr\/local\/mysql mysql\u5b89\u88dd\u7684\u76ee\u7684\u76ee\u9304<\/p>\n<p> #sysconfdir=\/etc my.ini\u914d\u7f6e\u6a94\u6848\u7684\u8def\u5f91<\/p>\n<p> #localstatedir=\/var\/lib\/mysql \u8cc7\u6599\u5eab\u5b58\u653e\u7684\u8def\u5f91<\/p>\n<p> \u5b89\u88dd\u5b8c\u4ee5\u5f8c\u8981\u8d77\u59cb\u5316\u8cc7\u6599\u5eab\uff0c\u7576\u7136\u4f60\u662f\u5347\u7d1a\u7684\u8a71\u4e0d\u7528\u505a\u9019\u6b65\uff1b<\/p>\n<p> \/usr\/local\/mysql\/bin\/mysql_install_db<\/p>\n<p> \u5982\u679c\u7cfb\u7d71\u6c92\u6709mysql\u9019\u500b\u4f7f\u7528\u8005\u7684\u8a71\uff0c\u6700\u597d\u505a\u4ee5\u4e0b\u9019\u6b65\uff1a<\/p>\n<p> useradd -M -o -r -d \/var\/lib\/mysql -s \/bin\/bash -c &quot;MySQL Server&quot; -u 27 mysql<\/p>\n<p> \u7136\u5f8c\u6211\u555f\u52d5mysql<\/p>\n<p> \/usr\/local\/mysql\/bin\/safe_mysqld &amp;<\/p>\n<p> ok\uff0c\u5148\u770b\u770bmysql\u80fd\u5426\u6a19\u6e96\u5de5\u4f5c<\/p>\n<p> mysql -uroot mysql<\/p>\n<p> \u4e00\u822c\u60c5\u6cc1\u4e0b\u90fd\u662f\u4e0d\u80fd\u6a19\u6e96\u9023\u7d50\u8cc7\u6599\u5eab\uff0c\u932f\u8aa4\u63d0\u793a\u4e00\u822c\u70ba\uff1a<\/p>\n<p> ERROR 2002: Can&#39;t connect to local MySQL server through socket &#39;\/var\/lib\/mysql\/mysql.sock&#39; (2)<\/p>\n<p> \u5176\u5be6\u7db2\u4e0a\u5927\u5bb6\u554f\u7684\u6700\u591a\u7684\u90fd\u662f\u6574\u500b\u554f\u984c\uff0c\u8aaa\u4ec0\u9ebc\u9023\u7d50\u4e0d\u5230mysqld.sock\uff0c\u5176\u5be6\u5927\u5bb6\u4e0d\u59a8\u770b\u770bmysql\u7684\u932f\u8aa4\u65e5\u8a8c\u5c31\u660e\u767d\u600e\u9ebc\u56de\u4e8b\uff0c\u6211\u9019\u88e1\u7684\u932f\u8aa4\u65e5\u8a8c\u662f\u5728<\/p>\n<p> \/var\/lib\/mysql\/*.err \u4f60\u6703\u767c\u73femysql\u53ea\u6240\u4ee5\u4e0d\u80fd\u555f\u52d5\uff0c\u662f\u56e0\u70ba\/var\/lib\/mysql\u7684\u6b0a\u9650\u4e0d\u5bb9\u8a31mysql\u670d\u52d9\u8a2a\u554f\uff0c\u82f1\u6587mysql\u9810\u8a2d\u662f\u547c\u53ebmysql\u4f7f\u7528\u8005\u4f86\u555f\u52d5\u670d\u52d9\u7684\uff0c\u597d\u4e86\uff0c\u65e2\u7136\u77e5\u9053\u662f\u4ec0\u9ebc\u539f\u56e0\u627e\u5230\u4e0d\u80fd\u555f\u52d5\uff0c\u90a3\u5c31\u7c21\u55ae\u4e86\u3002\u6211\u5011\u53ea\u8981<\/p>\n<p> chown -R mysql:mysql \/var\/lib\/mysql \u5c31\u884c\uff0c\u5982\u679c\u9084\u662f\u555f\u52d5\u4e0d\u4e86\uff0c\u518d\u6162\u6162\u9664\u932f\u6b0a\u9650\uff0c\u53cd\u6b63\u4e00\u822c\u555f\u52d5\u4e0d\u4e86\u90fd\u662f\u6b0a\u9650\u7684\u554f\u984c\u3002<\/p>\n<p> \u5982\u679c\u5927\u5bb6\u9084\u662f\u4e0d\u80fd\u555f\u52d5\u4e0d\u4e86\u7684\u8a71\uff0c\u90a3\u5c31\u7528\u6211\u7684\u6bd4\u8f03\u7e41\u7463\u7684\u6b0a\u9650\u7684\u8a2d\u5b9a\uff0c\u53cd\u6b63\u6211\u6bcf\u6b21\u90fd\u662f\u9019\u9ebc\u505a\u7684\uff0c\u4e00\u822c\u4e0d\u6703\u6709\u554f\u984c\uff0c\u898b\u4e0b\uff1a<\/p>\n<p> chown -R root \/usr\/local\/mysql<br \/> chgrp -R mysql \/usr\/local\/mysql<br \/> chown -R root \/usr\/local\/mysql\/bin<br \/> chgrp -R mysql \/usr\/local\/mysql\/bin<br \/> chgrp -R mysql \/var\/lib\/mysql<br \/> chmod 777 \/var\/lib\/mysql<br \/> chown -R root \/var\/lib\/mysql\/mysql<br \/> chgrp -R mysql \/var\/lib\/mysql\/mysql<br \/> chmod 777 \/var\/lib\/mysql\/mysql<br \/> chown -R root \/var\/lib\/mysql\/mysql\/*<br \/> chgrp -R mysql \/var\/lib\/mysql\/mysql\/*<br \/> chmod 777 \/var\/lib\/mysql\/mysql\/*<br \/> chmod 777 \/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a<\/p>\n<p> \u505a\u5b8c\u4e0a\u9762\u7684\u6b65\u9a5f\uff0c\u7136\u5f8c\u628a\u4f60\u7de8\u8b6f\u76ee\u9304\u7684\u4e00\u500b\u8173\u672cCOPY\u904e\u53bb<\/p>\n<p> cp support-files\/mysql.server \/etc\/rc.d\/init.d\/mysqld<\/p>\n<p> chkconfig &#8211;add mysqld<\/p>\n<p> \u7528ntsysv\u8a2d\u5b9a\u4f7fmysql\u6bcf\u6b21\u555f\u52d5\u90fd\u80fd\u81ea\u52d5\u904b\u884c\u3002<\/p>\n<p> \u597d\u4e86\uff0c\u81f3\u6b64mysql\u5b89\u88dd\u5b8c\u7562\uff0c\u4f60\u53ef\u4ee5\u9019\u6a23\u8d77\u52d5\u4f60\u7684mysql\u670d\u52d9<\/p>\n<p> \/etc\/rc.d\/init.d\/mysqld start<\/p>\n<p> \u4e0b\u9762\u9019\u6b65\u6bd4\u8f03\u95dc\u9375\uff0c<\/p>\n<p> ln -s \/usr\/local\/mysql\/lib\/mysql \/usr\/lib\/mysql<br \/> ln -s \/usr\/local\/mysql\/include\/mysql \/usr\/include\/mysql<\/p>\n<p> \u5927\u5bb6\u53ef\u4ee5\u4e0d\u505a\u9019\u6b65\uff0c\u5927\u53ef\u4ee5\u5728\u7de8\u8b6f\u5176\u4ed6\u8edf\u9ad4\u7684\u6642\u5019\u81ea\u8a02myslq\u7684\u5eab\u6a94\u6848\u8def\u5f91\uff0c\u4f46\u6211\u9084\u662f\u559c\u6b61\u628a\u5eab\u6a94\u6848\u9023\u7d50\u5230\u9810\u8a2d\u7684\u4f4d\u7f6e\uff0c\u9019\u6a23\u4f60\u5728\u7de8\u8b6f\u985e\u4f3cPHP\uff0cVpopmail\u7b49\u8edf\u9ad4\u6642\u53ef\u4ee5\u4e0d\u7528\u6307\u5b9amysql\u7684\u5eab\u6a94\u6848\u4f4d\u5740\u3002<\/p>\n<p> 2.\u5b89\u88ddApache1.3.29\u3002\u6211\u6c92\u6709\u9078\u53d6\u5b89\u88ddApache2.0\u662f\u6211\u5c0d\u4ed6\u9084\u662f\u4e0d\u653e\u5fc3\uff0c\u56e0\u70ba\u7db2\u4e0a\u6700\u65b0\u516c\u4f48\u7684apache\u7684\u6f0f\u6d1e\u57fa\u672c\u4e0a\u662f\u91dd\u5c0d2.0\uff0c\u7576\u7136\u5927\u5bb6\u53ef\u4ee5\u81ea\u5df1\u9078\u53d6\u5b89\u88dd\u76f8\u61c9\u7684\u7248\u672c\u3002\u6211\u9019\u88e1\u8b1b\u7684\u90fd\u662f\u63a1\u7528DSO\u52d5\u614b\u7de8\u8b6f\u7684\u65b9\u6cd5\u7de8\u8b6fApache.<\/p>\n<p> \u8edf\u9ad4\u53d6\u5f97\uff1ahttp:\/\/httpd.apache.org\/<\/p>\n<p> tar zvxf apache_1.3.29.tar.gz<br \/> cd apache_1.3.29<br \/> \u4fee\u6539src\/include\/httpd.h \u589e\u5927\u6700\u5927\u57f7\u884c\u7dd2\u6578<\/p>\n<p> #define HARD_SERVER_LIMIT 256<\/p>\n<p> \u6539\u6210<\/p>\n<p> #define HARD_SERVER_LIMIT 2560<\/p>\n<p> \u5132\u5b58\u96e2\u958b\u7de8\u8b6fapache<\/p>\n<p> .\/configure &#8211;prefix=\/usr\/local\/apache &#8211;enable-module=so &#8211;enable-module=rewrite &#8211;enable-shared=max &#8211;htdocsdir=\/var\/www &amp;&amp;<br \/> make &amp;&amp;<br \/> make install<\/p>\n<p> #\u9019\u88e1\u6211\u5011\u901a\u904e enable-module\u53c3\u6578\u544a\u8a34\u8a2d\u5b9a\u8173\u672c\uff0c\u6211\u5011\u9700\u8981\u555f\u52d5so\u548crewrite\u6a21\u7d44\uff0cso\u6a21\u7d44\u662f\u7528\u4f86\u63d0DSO\u652f\u63f4\u7684apache\u6838\u5fc3\u6a21\u7d44\uff0c\u800c rewrite\u6a21\u7d44\u5247\u662f\u7528\u610f\u5be6\u73fe\u4f4d\u5740\u91cd\u5beb\u7684\u6a21\u7d44\uff0c\u7531\u65bcrewrite\u6a21\u7d44\u9700\u8981DBM\u652f\u63f4\uff0c\u5982\u679c\u5728\u521d\u6b21\u5b89\u88dd\u6642\u6c92\u6709\u7de8\u8b6f\u9032apache\uff0c\u4ee5\u5f8c\u9700\u8981\u7528\u5230\u6642\u9700\u8981\u91cd\u65b0\u7de8\u8b6f\u6574\u500bapache\u624d\u53ef\u4ee5\u5be6\u73fe\u3002\u70ba\u6b64\u9664\u975e\u4f60\u53ef\u4ee5\u78ba\u5b9a\u4ee5\u5f8c\u4e0d\u6703\u7528\u5230rewrite\u6a21\u7d44\uff0c\u5426\u5247\u9084\u662f\u5efa\u8b70\u4f60\u5728\u7b2c\u4e00\u6b21\u7de8\u8b6f\u7684\u6642\u5019\u628arewrite\u6a21\u7d44\u7de8\u8b6f\u597d\u3002<\/p>\n<p> enable-shared=max \u9019\u500b\u53c3\u6578\u7684\u4f5c\u7528\u6642\u7de8\u8b6fapache\u6642\uff0c\u628a\u9664\u4e86so\u4ee5\u5916\u7684\u6240\u6709apache\u7684\u6a19\u6e96\u6a21\u7d44\u90fd\u7de8\u8b6f\u6210DSO\u6a21\u7d44\u3002\u800c\u4e0d\u662f\u7de8\u8b6f\u9032apache\u6838\u5fc3\u5167\u3002<\/p>\n<p> \u597d\u4e86\u5b89\u88ddapache\u5f88\u7c21\u55ae\u7684\u54e6\uff0c\u555f\u52d5apache\u770b\u770b<\/p>\n<p> \/usr\/local\/apache\/bin\/apachectl start<\/p>\n<p> \u7136\u5f8c\u7528ie\u770bhttp:\/\/\u4f60\u7684\u4f3a\u670d\u5668\u4f4d\u5740\u3002\u61c9\u8a72\u80fd\u770b\u5230\u719f\u6089\u7684apache\u7fbd\u6bdb\u6a19\u8a8c\u3002<\/p>\n<p> 3.\u5b89\u88ddPHP4.3.4<\/p>\n<p> \u8edf\u9ad4\u53d6\u5f97\uff1ahttp:\/\/www.php.net\/downloads.php<\/p>\n<p> tar zvxf php-4.3.4.tar.gz<br \/> cd php-4.3.4<\/p>\n<p> .\/configure &#8211;prefix=\/usr\/local\/php &#8211;with-mysql=\/usr\/local\/mysql &#8211;enable-force-cgi-redirect &#8211;with-freetype-dir=\/usr &#8211;with-png-dir=\/usr &#8211;with-gd &#8211;enable-gd-native-ttf &#8211;with-ttf &#8211;with-gdbm &#8211;with-gettext &#8211;with-iconv &#8211;with-jpeg-dir=\/usr &#8211;with-png &#8211;with-zlib &#8211;with-xml &#8211;enable-calendar &#8211;with-apxs=\/usr\/local\/apache\/bin\/apxs<\/p>\n<p> make<\/p>\n<p> make install<\/p>\n<p> #\u6211\u9019\u88e1\u7531\u65bc\u4f3a\u670d\u5668\u9700\u8981\u7528\u5230GD\u5eab\uff0c\u6240\u4ee5\u52a0\u4e86\u4e00\u4e9b\u652f\u63f4GD\u7684\u7de8\u8b6f\u53c3\u6578\uff0cGD\u76f4\u63a5\u7528\u4e86redhat\u81ea\u5e36\u7684GD\u5eab\uff0c\u5927\u5bb6\u6c92\u6709\u5b89\u88dd\u7684\u8a71\u53ef\u4ee5\u5f9e\u5b89\u88dd\u76e4\u5b89\u88dd\uff0c\u6ce8\u610f\u9664\u4e86\u5b89\u88ddGD\u4ee5\u5916\uff0c\u9084\u8981\u5b89\u88ddlibjpeg\uff0clibpng\u7b49\u5eab\u6a94\u6848\u3002\u53e6\u5916&#8211;with-mysql=\/usr\/local\/mysql\u6307\u5411\u4f60\u5b89\u88ddmysql\u7684\u8def\u5f91\u3002&#8211;with-apxs\u6307\u5411apache\u7684apxs\u6a94\u6848\u7684\u8def\u5f91\u3002<\/p>\n<p> vi \/usr\/local\/apache\/conf\/httpd.conf<\/p>\n<p> \u5c0b\u627e&lt;IfModule mod_mime.c&gt;<\/p>\n<p> \u5728\u6b64\u7bc4\u570d\u52a0\u5165<\/p>\n<p> AddType application\/x-httpd-php .php<br \/> AddType application\/x-httpd-php-source .phps<\/p>\n<p> \u7136CPOPY PHP\u7684\u914d\u7f6e\u6a94\u6848<\/p>\n<p> cp ..\/php4.3.4\/php.ini.dist \/usr\/local\/php\/lib\/php.ini<\/p>\n<p> \u4fee\u6539php.ini\u6a94\u6848<br \/> register_globals = On<\/p>\n<p> ok\uff01\u91cd\u65b0\u555f\u52d5\u4e00\u4e0bapache\u4f3a\u670d\u5668<br \/> \/usr\/local\/apache\/bin\/apachectl restart<\/p>\n<p> \u7136\u5f8c\u5beb\u500bphp\u6e2c\u8a66\u9801info.php:\u5167\u5bb9\u5982\u4e0b<\/p>\n<p> &lt;?php<br \/> phpinfo();<br \/> ?&gt;<\/p>\n<p> \u6a19\u6e96\u7684\u8a71\uff0c\u61c9\u8a72\u80fd\u770b\u5230php\u7684\u8a0a\u606f\u4e86\uff0c\u606d\u559c\u4f60\u7684Apche+Mysql+PHP\u5b89\u88dd\u5b8c\u6210\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux+Apache+Mysql+PHP\u5178\u578b\u914d\u7f6e\uff08Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff09 Linux\u7cfb\u7d71\u7684\u5b89\u88dd\u6211\u5c31 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":497,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[26],"class_list":["post-49","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-15","tag-26"],"_links":{"self":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/49"}],"collection":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media\/497"}],"wp:attachment":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}