{"id":51665,"date":"2024-10-08T20:32:16","date_gmt":"2024-10-08T12:32:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/51665\/"},"modified":"2024-11-14T10:42:19","modified_gmt":"2024-11-14T02:42:19","slug":"ubuntu-18-04-16-04-%e9%80%9a%e9%81%8e%e4%bf%ae%e6%94%b9-ppa-%e6%ba%90%e5%ae%89%e8%a3%9d-php-7-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/51665\/","title":{"rendered":"Ubuntu 18.04\/16.04 \u901a\u904e\u4fee\u6539 PPA \u6e90\u5b89\u88dd PHP 7.2"},"content":{"rendered":"<h1 id=\"ubuntu-18-04-16-04-%e9%80%9a%e9%81%8e%e4%bf%ae%e6%94%b9-ppa-%e6%ba%90%e5%ae%89%e8%a3%9d-php-7-2-NTwAESKQKr\">Ubuntu 18.04\/16.04 \u901a\u904e\u4fee\u6539 PPA \u6e90\u5b89\u88dd PHP 7.2<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0cPHP \u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u4f3a\u670d\u5668\u7aef\u8173\u672c\u8a9e\u8a00\uff0c\u7279\u5225\u662f\u5728\u958b\u767c\u52d5\u614b\u7db2\u7ad9\u548c\u7db2\u7d61\u61c9\u7528\u7a0b\u5e8f\u65b9\u9762\u3002\u96a8\u8457 PHP \u7248\u672c\u7684\u66f4\u65b0\uff0c\u958b\u767c\u8005\u5011\u9700\u8981\u4e0d\u65b7\u66f4\u65b0\u5176\u74b0\u5883\u4ee5\u5229\u7528\u65b0\u529f\u80fd\u548c\u5b89\u5168\u6027\u6539\u9032\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 Ubuntu 18.04 \u548c 16.04 \u7cfb\u7d71\u4e0a\u901a\u904e\u4fee\u6539 PPA \u6e90\u4f86\u5b89\u88dd PHP 7.2\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-ppa%ef%bc%9f-NTwAESKQKr\">\u4ec0\u9ebc\u662f PPA\uff1f<\/h2>\n<p>PPA\uff08Personal Package Archive\uff09\u662f\u4e00\u7a2e\u7531 Ubuntu \u793e\u5340\u6210\u54e1\u63d0\u4f9b\u7684\u8edf\u4ef6\u5305\u5b58\u5132\u5eab\uff0c\u5141\u8a31\u7528\u6236\u5b89\u88dd\u548c\u66f4\u65b0\u8edf\u4ef6\u5305\u3002\u901a\u904e\u4f7f\u7528 PPA\uff0c\u7528\u6236\u53ef\u4ee5\u7372\u5f97\u6700\u65b0\u7248\u672c\u7684\u8edf\u4ef6\uff0c\u800c\u4e0d\u5fc5\u7b49\u5f85\u5b98\u65b9\u7684\u66f4\u65b0\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-php-7-2-%e7%9a%84%e6%ad%a5%e9%a9%9f-NTwAESKQKr\">\u5b89\u88dd PHP 7.2 \u7684\u6b65\u9a5f<\/h2>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e6%9b%b4%e6%96%b0%e7%b3%bb%e7%b5%b1-NTwAESKQKr\">\u6b65\u9a5f 1\uff1a\u66f4\u65b0\u7cfb\u7d71<\/h3>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u78ba\u4fdd\u7cfb\u7d71\u662f\u6700\u65b0\u7684\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u66f4\u65b0\u7cfb\u7d71\uff1a<\/p>\n<pre><code>sudo apt update\nsudo apt upgrade<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e6%b7%bb%e5%8a%a0-ppa-%e6%ba%90-NTwAESKQKr\">\u6b65\u9a5f 2\uff1a\u6dfb\u52a0 PPA \u6e90<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u9700\u8981\u6dfb\u52a0 PHP \u7684 PPA \u6e90\u3002\u9019\u88e1\u6211\u5011\u5c07\u4f7f\u7528 <code>ondrej\/php<\/code> PPA\uff0c\u9019\u662f\u4e00\u500b\u975e\u5e38\u53d7\u6b61\u8fce\u7684 PHP \u5b58\u5132\u5eab\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6dfb\u52a0 PPA\uff1a<\/p>\n<pre><code>sudo add-apt-repository ppa:ondrej\/php<\/code><\/pre>\n<p>\u6dfb\u52a0 PPA \u5f8c\uff0c\u8acb\u518d\u6b21\u66f4\u65b0\u7cfb\u7d71\u4ee5\u7372\u53d6\u65b0\u6e90\u7684\u5305\u4fe1\u606f\uff1a<\/p>\n<pre><code>sudo apt update<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e5%ae%89%e8%a3%9d-php-7-2-NTwAESKQKr\">\u6b65\u9a5f 3\uff1a\u5b89\u88dd PHP 7.2<\/h3>\n<p>\u73fe\u5728\u53ef\u4ee5\u5b89\u88dd PHP 7.2 \u4e86\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo apt install php7.2<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5 PHP \u7684\u7248\u672c\uff1a<\/p>\n<pre><code>php -v<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-4%ef%bc%9a%e5%ae%89%e8%a3%9d%e5%b8%b8%e7%94%a8%e7%9a%84-php-%e6%93%b4%e5%b1%95-NTwAESKQKr\">\u6b65\u9a5f 4\uff1a\u5b89\u88dd\u5e38\u7528\u7684 PHP \u64f4\u5c55<\/h3>\n<p>\u6839\u64da\u9700\u8981\uff0c\u60a8\u53ef\u80fd\u9084\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5e38\u7528\u7684 PHP \u64f4\u5c55\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u64f4\u5c55\u53ca\u5176\u5b89\u88dd\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li><code>sudo apt install php7.2-mysql<\/code> &#8211; \u7528\u65bc MySQL \u6578\u64da\u5eab\u7684\u652f\u6301<\/li>\n<li><code>sudo apt install php7.2-xml<\/code> &#8211; \u7528\u65bc XML \u8655\u7406\u7684\u652f\u6301<\/li>\n<li><code>sudo apt install php7.2-mbstring<\/code> &#8211; \u7528\u65bc\u591a\u5b57\u7bc0\u5b57\u7b26\u4e32\u8655\u7406\u7684\u652f\u6301<\/li>\n<li><code>sudo apt install php7.2-curl<\/code> &#8211; \u7528\u65bc CURL \u7684\u652f\u6301<\/li>\n<\/ul>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u5df2\u5b89\u88dd\u7684\u64f4\u5c55\uff1a<\/p>\n<pre><code>php -m<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-NTwAESKQKr\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5728 Ubuntu 18.04 \u548c 16.04 \u7cfb\u7d71\u4e0a\u6210\u529f\u5b89\u88dd PHP 7.2\u3002\u9019\u4e0d\u50c5\u80fd\u5920\u5e6b\u52a9\u60a8\u5229\u7528\u6700\u65b0\u7684 PHP \u529f\u80fd\uff0c\u9084\u80fd\u63d0\u9ad8\u61c9\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u548c\u6027\u80fd\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u904b\u884c\u60a8\u7684 PHP \u61c9\u7528\u7a0b\u5e8f\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f\u500b\u4eba\u9805\u76ee\u9084\u662f\u5546\u696d\u61c9\u7528\uff0c\u60a8\u90fd\u53ef\u4ee5\u5728\u6211\u5011\u7684\u7db2\u7ad9\u4e0a\u627e\u5230\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install PHP 7.2 on Ubuntu 18.04\/16.04 by modifying PPA sources for enhanced performance and features. Step-by-step guide included.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-51665","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=51665"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51665\/revisions"}],"predecessor-version":[{"id":51666,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51665\/revisions\/51666"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=51665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=51665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=51665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}