{"id":3299,"date":"2018-03-31T13:09:28","date_gmt":"2018-03-31T05:09:28","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=3299"},"modified":"2018-03-31T13:09:28","modified_gmt":"2018-03-31T05:09:28","slug":"%e4%b8%80%e6%96%87%e5%bd%bb%e5%ba%95%e8%a7%a3%e5%86%b3ubuntu%e4%b8%8aphp%e7%9a%84%e5%ae%89%e8%a3%85%e4%bb%a5%e5%8f%8a%e7%89%88%e6%9c%ac%e5%88%87%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/%e4%b8%80%e6%96%87%e5%bd%bb%e5%ba%95%e8%a7%a3%e5%86%b3ubuntu%e4%b8%8aphp%e7%9a%84%e5%ae%89%e8%a3%85%e4%bb%a5%e5%8f%8a%e7%89%88%e6%9c%ac%e5%88%87%e6%8d%a2\/","title":{"rendered":"\u4e00\u6587\u5f7b\u5e95\u89e3\u51b3Ubuntu\u4e0aPHP\u7684\u5b89\u88c5\u4ee5\u53ca\u7248\u672c\u5207\u6362"},"content":{"rendered":"<p><a title=\"Ubuntu\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=2\" target=\"_blank\">Ubuntu<\/a>\u4e0a\u5b98\u65b9\u7684\u6e90\uff0c\u6bd4\u5982 Ubuntu14.04 \u9ed8\u8ba4\u6e90\u4e2d\u7684\u662f PHP5.6.x\u3001Ubuntu16.04 \u9ed8\u8ba4\u6e90\u4e2d\u7684\u662f PHP7.0.x\uff0c\u90a3\u4e48\u5982\u679c\u60f3\u5728 Ubuntu16.04 \u4e0a\u5b89\u88c5 PHP7.1\uff0cPHP7.2\uff0c\u5e94\u8be5\u600e\u4e48\u529e\u5462\uff1f<\/p>\n<p>\u7b54\u6848\u662f\u901a\u8fc7\u7b2c\u4e09\u65b9\u7684\u6e90\u6765\u5b89\u88c5\uff0cppa:ondrej\/php \u662f\u4e00\u4e2a\u6bd4\u8f83\u77e5\u540d\u7684PHP\u6e90\uff08\u76ee\u524d\u7ef4\u62a4php5.6,php7.0,php7.1,php7.2\uff09\u3002\u4e0b\u9762\u5c31\u7528\u8fd9\u4e2a\u6e90\u6765\u5b89\u88c5\u81ea\u5df1\u60f3\u8981\u7684PHP\u7248\u672c\u3002<\/p>\n<p>1.\u901a\u8fc7\u6e90\u5b89\u88c5PHP<\/p>\n<p>sudo add-apt-repository ppa:ondrej\/php<br \/>\nsudo apt-get update<br \/>\nsudo apt-get upgrade<br \/>\nsudo apt-get install php7.1\u00a0 # for PHP 7.1<br \/>\nsudo apt-get install php7.0\u00a0 # for PHP 7.0<br \/>\nsudo apt-get install php5.6\u00a0 # for PHP 5.6<\/p>\n<p>2.\u5b89\u88c5\u76f8\u5173\u7248\u672c\u7684PHP\u6a21\u5757<\/p>\n<p>sudo apt-cache search php7*<br \/>\n&#8230;<br \/>\nphp-all-dev &#8211; package depending on all supported PHP development packages<br \/>\nphp7.0 &#8211; server-side, HTML-embedded scripting language (metapackage)<br \/>\nphp7.0-cgi &#8211; server-side, HTML-embedded scripting language (CGI binary)<br \/>\nphp7.0-cli &#8211; command-line interpreter for the PHP scripting language<br \/>\nphp7.0-common &#8211; documentation, examples and common module for PHP<br \/>\nphp7.0-curl &#8211; CURL module for PHP<br \/>\nphp7.0-dev &#8211; Files for PHP7.0 module development<br \/>\nphp7.0-gd &#8211; GD module for PHP<br \/>\nphp7.0-gmp &#8211; GMP module for PHP<br \/>\n&#8230;<br \/>\n&#8230;<br \/>\n&#8230;<br \/>\nphp7.1-xml &#8211; DOM, SimpleXML, WDDX, XML, and XSL module for PHP<br \/>\nphp7.1-xmlrpc &#8211; XMLRPC-EPI module for PHP<br \/>\nphp7.1-zip &#8211; Zip module for PHP<br \/>\nphp7.1-opcache &#8211; Zend OpCache module for PHP<br \/>\nphp7.1 &#8211; server-side, HTML-embedded scripting language (metapackage)<br \/>\nphp7.1-xsl &#8211; XSL module for PHP (dummy)<br \/>\n&#8230;<br \/>\n&#8230;<br \/>\nphp7.2-bcmath &#8211; Bcmath module for PHP<br \/>\nphp7.2-bz2 &#8211; bzip2 module for PHP<br \/>\nphp7.2-cgi &#8211; server-side, HTML-embedded scripting language (CGI binary)<br \/>\nphp7.2-cli &#8211; command-line interpreter for the PHP scripting language<br \/>\nphp7.2-common &#8211; documentation, examples and common module for PHP<br \/>\nphp7.2-curl &#8211; CURL module for PHP<br \/>\nphp7.2-dba &#8211; DBA module for PHP<\/p>\n<p>3.\u9009\u62e9\u9700\u8981\u7684\u6a21\u5757\uff0c\u5b89\u88c5\u4e4b<\/p>\n<p>sudo apt-get install php7.2-curl php7.2-dev php7.2-gd php7.2-imap php7.2-intl php7.2-mbstring php7.2-mysql php7.2-xml php7.2-zip<\/p>\n<p>4.\u5207\u6362PHP\u7248\u672c<\/p>\n<p>sudo update-alternatives &#8211;config php<\/p>\n<p>5.\u8bbe\u7f6eApache\u4e0e\u6b63\u786e\u7684PHP\u7248\u672c\u4e00\u8d77\u8fd0\u884c<\/p>\n<p>sudo a2dismod php7.1\u00a0 \u00a0 \u00a0 \u00a0 # unload the current version<br \/>\nsudo a2enmod\u00a0 php5.6\u00a0 \u00a0 \u00a0 \u00a0 # load the version you need<br \/>\nsudo service apache2 restart # restart webserver to apply<\/p>\n<p>\u5230\u6b64\u7ed3\u675f\uff0c\u518d\u4e5f\u4e0d\u7528\u62c5\u5fc3\u5b89\u88c5PHP\uff0c\u5207\u6362PHP\u7248\u672c\u8fd9\u4e9b\u4e8b\u60c5\u5566\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu\u4e0a\u5b98\u65b9\u7684\u6e90\uff0c\u6bd4\u5982 Ubuntu14.04 \u9ed8\u8ba4\u6e90\u4e2d\u7684\u662f PHP5.6.x\u3001Ubuntu16.04  &#8230; <a title=\"\u4e00\u6587\u5f7b\u5e95\u89e3\u51b3Ubuntu\u4e0aPHP\u7684\u5b89\u88c5\u4ee5\u53ca\u7248\u672c\u5207\u6362\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/%e4%b8%80%e6%96%87%e5%bd%bb%e5%ba%95%e8%a7%a3%e5%86%b3ubuntu%e4%b8%8aphp%e7%9a%84%e5%ae%89%e8%a3%85%e4%bb%a5%e5%8f%8a%e7%89%88%e6%9c%ac%e5%88%87%e6%8d%a2\/\" aria-label=\"\u9605\u8bfb \u4e00\u6587\u5f7b\u5e95\u89e3\u51b3Ubuntu\u4e0aPHP\u7684\u5b89\u88c5\u4ee5\u53ca\u7248\u672c\u5207\u6362\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[383],"class_list":["post-3299","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-ubuntu"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=3299"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3299\/revisions"}],"predecessor-version":[{"id":3300,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3299\/revisions\/3300"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=3299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=3299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=3299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}