{"id":865,"date":"2013-02-13T15:16:00","date_gmt":"2013-02-13T07:16:00","guid":{"rendered":""},"modified":"2014-01-06T23:12:48","modified_gmt":"2014-01-06T15:12:48","slug":"ubuntu%e4%b8%8bphp%e7%9a%84%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2013\/02\/13\/865.htm","title":{"rendered":"ubuntu\u4e0bphp\u7684\u5b89\u88c5"},"content":{"rendered":"<p><span style=\"color: #333333; font-family: Arial; line-height: 26px;\">1\u3001\u5b89\u88c5PHP\u652f\u6301\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">$sudo apt-get install libapache2-mod-php5\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">$sudo apt-get install php5\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">\u5982\u679c\u60f3\u652f\u6301\u56fe\u5f62\u5c31\u52a0php5-gd\uff0c\u5982\u679c\u60f3\u652f\u6301Mysql\u5c31\u52a0php5-mysql\uff0c\u8fd9\u91cc\u4e4b\u6240\u4ee5\u8981\u5355\u72ec\u5217\u51falibapache2-mod- php5\uff0c\u4e3b\u8981\u662f\u7531\u4e8ephp5\u7684\u4f9d\u8d56\u5173\u7cfb\u6ca1\u6709\u505a\u597d\uff0c\u6709\u53ef\u80fd\u4f1a\u5b89\u88c5\u4e0alibapache-mod-php5\u7684\u5305\uff0c\u6240\u4ee5\u4e3a\u4e86\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u9ebb\u70e6\uff0c\u5e72\u8106\u8fd8\u662f\u5355\u72ec\u6307 \u5b9a\u6bd4\u8f83\u597d\u3002<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">2\u3001\u4fee\u6539PHP\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u9650\u5236\u5185\u5b58\u548c\u6587\u4ef6\u6700\u5927\u4e0a\u4f20\u5c3a\u5bf8\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">\u6211\u4eec\u7f16\u8f91\/etc\/php5\/apache2\/php.ini\u6587\u4ef6\uff0c\u5148\u505a\u4e00\u822c\u914d\u7f6e\uff0c\u5728\u6539\u52a8\u4e4b\u524d\uff0c\u8bf7\u5148\u5c06\u8be5\u914d\u7f6e\u6587\u4ef6\u505a\u4e2a\u5907\u4efd\u3002\u4ee5\u4fbf\u5728\u51fa\u9519\u7684\u65f6\u5019\u53ef\u4ee5\u6062\u590d\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;memory_limit = 8M =&gt;\u4fee\u6539\u6210\u4f60\u6240\u9700\u7684\u5185\u5b58\u5927\u5c0f\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;upload_max_filesize = 2M =&gt;\u4fee\u6539\u6587\u4ef6\u6700\u5927\u4e0a\u4f20\u5c3a\u5bf8\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">=============\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;extension=mysql.so \u652f\u6301Mysql\u670d\u52a1\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;extension=gd.so \u652f\u6301gd\u51fd\u6570\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">=============\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">\u5176\u5b9e\u5728Ubuntu\u4e0b\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u4e86php5-mysql\u548cphp5-gd\u4e4b\u540e\uff0c\u4f1a\u81ea\u52a8\u4fee\u6539\u4ee5\u4e0a\u4e8c\u884c\u7684\uff0c\u6211\u4eec\u505a\u7684\u53ea\u4e0d\u8fc7\u662f\u786e\u8ba4\u4e00\u4e0b\u5b83\u4eec\u524d\u9762\u7684\u6ce8\u91ca\u7b26\u662f\u5426\u53bb\u6389\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">3\u3001\u52a0\u56faPHP\uff0c\u4ee5\u589e\u5f3a\u5b89\u5168\u6027\u3002\u6ce8\u610f\uff0c\u4e0b\u9762\u7684\u5b89\u5168\u6027\u8981\u56e0\u60c5\u51b5\u800c\u5b9a\uff0c\u6240\u4ee5\u6211\u5df2\u7ecf\u628a\u5b83\u4eec\u7684\u529f\u80fd\u5199\u6e05\u695a\u4e86\uff0c\u5982\u679c\u6709\u95ee\u9898\u7684\u8bdd\uff0c\u770b\u770b\u662f\u5426\u7531\u4e8e\u4e0b\u9762\u54ea\u79cd\u9650\u5236\u6761\u4ef6\u6240\u9020\u6210\uff0c\u53ef\u76f8\u5e94\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">\u4e0b\u9762\u6211\u4eec\u5f00\u59cb\u52a0\u56faphp,\u6211\u4eec\u518d\u6b21\u7f16\u8f91\/etc\/php5\/apache2\/php.ini\u6587\u4ef6\uff0c\u4e4b\u6240\u4ee5\u6ca1\u6709\u4e00\u6b21\u6539\u5b8c\uff0c\u4e3b\u8981\u662f\u4e3a\u4e86\u7ed9\u5927\u5bb6\u4e00\u4e2a\u6e05\u6670\u7684\u601d\u8def\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u6253\u5f00\u5b89\u5168\u6a21\u5f0f\uff0c\u6253\u5f00\u4ed6\u7684\u597d\u5904\u5c31\u662fPHP\u6587\u4ef6\u53ea\u80fd\u8bbf\u95ee\u6240\u6709\u8005\u548cPHP\u6587\u4ef6\u6240\u6709\u7740\u4e00\u6837\u7684\u6587\u4ef6\uff0c\u5373\u4f7f\u5728chroot\u73af\u5883\u4e0b\u4e5f\u65e0\u6cd5\u8bbf\u95eejail \u4e2d\u5c5e\u4e3b\u4e0d\u4e00\u6837\u7684\u6587\u4ef6\uff0c\u7c7b\u4f3c\u4e8ephp shell\u8fd9\u6837\u7684\u540e\u95e8\u5c31\u6ca1\u7528\u6b66\u4e4b\u5730\u4e86\u54e6\uff0cphpshell\u662f\u5f88\u6d41\u884c\u7684php\u540e\u95e8\uff0c\u4ed6\u53ef\u4ee5\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\uff0c\u5c31\u8c61\u4ed6\u7684\u540d\u5b57\u4e00\u6837\uff0c\u548cshell\u5f88\u63a5\u8fd1\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;safe_mode = On\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u4e0b\u9762\u7684\u8bbe\u7f6e\u5c31\u9650\u5236\u4e86fopen(), file()\u7b49\u51fd\u6570\u53ef\u4ee5\u64cd\u4f5c\u7684\u76ee\u5f55\u8303\u56f4,\u907f\u514d\u4e86\u5165\u4fb5\u8005\u975e\u6cd5\u8bfb\u53d6\u6587\u4ef6,\u4e00\u5b9a\u8981\u5728\/var\/www\u540e\u9762\u52a0&#8221;\/&#8221;,\u5426\u5219\/var\/wwww\u4e0b\u7684\u6587\u4ef6\u4e5f\u80fd\u88ab\u8bbf\u95ee \u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u4efb\u4f55\u4e0d\u5728\/var\/www\/\u76ee\u5f55\u4e0b\u7684PHP\u6587\u4ef6\u8fd0\u884c\uff0c\u5305\u62ec\u4efb\u4f55\u4ee5\u8f6f\u94fe\u63a5\u65b9\u5f0f\u94fe\u5230\/var\/www\/\u76ee\u5f55\u4e0b\u7684\u7a0b\u5e8f\uff0c\u5982PhpMyAdmin \u5305\uff0c\u5c31\u5728\u8be5\u9009\u9879\u8bbe\u5b9a\u540e\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;open_basedir = \/var\/www\/\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u7981\u6b62\u4f7f\u7528phpinfo\u548cget_cfg_var\u51fd\u6570\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u6cc4\u9732\u670d\u52a1\u4fe1\u606f\uff0c\u4e00\u822c\u5728\u5728\u786e\u8ba4PHP\u80fd\u6b63\u5e38\u5de5\u4f5c\u4e4b\u540e\u518d\u4f7f\u4e4b\u5173\u95ed\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;disable_functions = phpinfo,get_cfg_var\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u8bbe\u7f6ephp\u7a0b\u5e8f\u9519\u8bef\u65e5\u5fd7\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;error_reporting = E_ALL\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;log_errors = On\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;error_log = \/var\/log\/php_err.log\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u5982\u679cphp\u7a0b\u5e8f\u6ca1\u6709\u6307\u660e\u9700\u8981register_globals\u7684\u8bdd\uff0c\u6700\u597d\u628aregister_globals\u8bbe\u7f6e\u4e3aOff,\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5f88\u591a\u5b89\u5168\u95ee\u9898\u7684\u3002\u6ce8\u610f\uff0c\u5982\u679c\u4f60\u7684\u7a0b\u5e8f\u662f\u9700\u8981register_globals\u7684\u8bdd\uff0c\u53ef\u5343\u4e07\u522b\u5173\u3002Ubuntu\u9ed8\u8ba4\u662f\u5173\u95ed\u7684\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;register_globals = Off\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;#\u7981\u6b62\u6253\u5f00\u8fdc\u7a0b\u5730\u5740,\u8bb0\u5f97\u6700\u8fd1\u51fa\u7684php include\u7684\u90a3\u4e2a\u6f0f\u6d1e\u5417\uff1f\u5c31\u662f\u5728\u4e00\u4e2aphp\u7a0b\u5e8f\u4e2dinclude\u4e86\u53d8\u91cf\uff0c\u90a3\u4e48\u5165\u4fb5\u8005\u5c31\u53ef\u4ee5\u5229\u7528\u8fd9\u4e2a\u63a7\u5236\u670d\u52a1\u5668\u5728\u672c\u5730\u6267\u884c\u8fdc\u7a0b\u7684\u4e00\u4e2aphp\u7a0b\u5e8f\uff0c\u4f8b\u5982phpshell,\u6240\u4ee5\u6211\u4eec\u5173\u95ed\u8fd9\u4e2a\u3002\u00a0<\/span><br style=\"margin: 0px; padding: 0px; color: #333333; font-family: Arial; line-height: 26px;\" \/><br \/>\n<span style=\"color: #333333; font-family: Arial; line-height: 26px;\">&gt;allow_url_fopen = Off<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"best-text mb-10\" id=\"best-content-555868378\" style=\"margin-top: 0px; margin-bottom: 10px; padding: 0px; font-family: arial, 'courier new', courier, \u5b8b\u4f53, monospace; white-space: pre-wrap; word-wrap: break-word; line-height: 24px; background-color: #fffcf6;\">\u6743\u9650\u95ee\u9898\u3002\r\n\u9ed8\u8ba4root\u62e5\u6709\u76ee\u5f55\u76847\u6743\u9650\r\n\u7ec8\u7aef\u91cc\u8f93\u5165\r\nsudo chmod 777 var\/www\r\n\u53ef\u4ee5\u66f4\u6539\u6743\u9650<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5b89\u88c5PHP\u652f\u6301\u00a0 $sudo apt-get install libapache2-mod-php5\u00a0 $sudo apt-get install php5\u00a0 \u5982\u679c\u60f3\u652f\u6301\u56fe\u5f62\u5c31\u52a0php5-gd\uff0c\u5982\u679c\u60f3\u652f\u6301Mysql\u5c31\u52a0php5-mysq&#8230;<\/p>\n","protected":false},"author":1,"featured_media":65680,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[25,30],"topic":[],"class_list":["post-865","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-phps","category-server","tag-php","tag-ubuntu"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=865"}],"version-history":[{"count":2,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/865\/revisions"}],"predecessor-version":[{"id":65682,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/865\/revisions\/65682"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media\/65680"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=865"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=865"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}