{"id":169031,"date":"2020-01-12T10:00:56","date_gmt":"2020-01-12T02:00:56","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=169031"},"modified":"2020-01-03T10:39:36","modified_gmt":"2020-01-03T02:39:36","slug":"ubuntu-debian-php","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-debian-php.html","title":{"rendered":"\u5982\u4f55\u5728Ubuntu 18.04\u548cDebian 9\u4e0a\u5b89\u88c5PHP 5.6"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6b63\u5982\u60a8\u5df2\u7ecf\u77e5\u9053\u7684\u90a3\u6837\uff0cUbuntu 18.04\u548cDebian 9\u53ef\u80fd\u5b89\u88c5\u4e86PHP 7\uff0c\u5e76\u4e14\u8bbe\u8ba1\u7528\u4e8ePHP 5\u7684\u5e94\u7528\u7a0b\u5e8f\uff08\u5982vnStat PHP\u524d\u7aef\uff0cPHP\u670d\u52a1\u5668\u76d1\u89c6\u5668\u7b49\uff09\uff0c\u53ef\u80fd\u7531\u4e8e\u517c\u5bb9\u6027\u95ee\u9898\u800c\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u9700\u8981\u5728Ubuntu 18.04\/Debian 9\u4e0a\u5b89\u88c5PHP 5.6\uff0c\u4ee5\u6ee1\u8db3\u60a8\u8981\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5b83\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u8981\u6c42\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5728Ubuntu 18.04\/Debian 9\u4e0a\u5b89\u88c5PHP 5.6\u7684\u6b65\u9aa4\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u8bbe\u7f6eOnd\u0159ej\u5b58\u50a8\u5e93<\/strong><\/div>\n

Ond\u0159ejSur\u00fd\u4e3aUbuntu\u548cDebian\u7ef4\u62a4PHP 5.6\u548cPHP 7.0\u5b58\u50a8\u5e93\u3002 \u6211\u4eec\u73b0\u5728\u5c06\u4f7f\u7528Ondej\u5b58\u50a8\u5e93\u6765\u5b89\u88c5PHP 5.6\u3002<\/p>\n

### Ubuntu 18.04 ###<\/p>\n

sudo apt-get update\r\nsudo apt-get install -y software-properties-common<\/pre>\n

\"\"<\/p>\n

sudo add-apt-repository ppa:ondrej\/php<\/pre>\n

\"\"<\/p>\n

### Debian 9 ###<\/p>\n

sudo apt-get update\r\nsudo apt-get install -y apt-transport-https curl\r\ncurl https:\/\/packages.sury.org\/php\/apt.gpg | sudo apt-key add -\r\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" | sudo tee \/etc\/apt\/sources.list.d\/php5.list<\/pre>\n

\u5728Ubuntu 18.04\/Debian 9\u4e0a\u5b89\u88c5PHP 5.6<\/p>\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u5b58\u50a8\u5e93\u7f13\u5b58\u3002<\/p>\n

sudo apt-get update<\/pre>\n

\u73b0\u5728\uff0c\u4f7f\u7528apt\u547d\u4ee4\u5b89\u88c5PHP 5.6\/PHP 7.0\u3002<\/p>\n

sudo apt-get install -y php5.6<\/pre>\n

\"\"<\/p>\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1PHP\u7248\u672c\u3002<\/strong><\/div>\n
linuxidc@linuxidc:~$ php -v<\/pre>\n

\u8f93\u51fa\uff1a<\/p>\n

PHP 5.6.38-3+ubuntu18.04.1+deb.sury.org+1 (cli) \r\nCopyright (c) 1997-2016 The PHP Group\r\nZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies\r\n    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies<\/pre>\n

\u5728Ubuntu 18.04\u4e0a\u5b89\u88c5PHP 5.6\u9a8c\u8bc1\u622a\u56fe\uff1a<\/p>\n

lsb_release -a<\/pre>\n

\"\"<\/p>\n

\u9644\u52a0\u8bf4\u660e\uff1a<\/strong><\/div>\n

\u60a8\u7684\u7cfb\u7edf\u53ef\u80fd\u5df2\u7ecf\u6709PHP 7\uff0c\u56e0\u6b64\u4e0a\u8ff0\u547d\u4ee4\u53ef\u80fd\u4f1a\u5c06PHP\u7248\u672c\u663e\u793a\u4e3a7.0\u62167.2\u3002<\/p>\n

\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u9ed8\u8ba4PHP\u7248\u672c\u8bbe\u7f6e\u4e3a5.6\uff0c\u5e76\u4e14\u53ef\u4ee5\u968f\u65f6\u5728PHP 5.6\u548cPHP 7\u4e4b\u95f4\u5207\u6362\u3002<\/p>\n

sudo update-alternatives --config php<\/pre>\n

\u5982\u679c\u6709\uff0c\u5219\u663e\u793a\u5982\u4e0b<\/p>\n

here are 2 choices for the alternative php (providing \/usr\/bin\/php).\r\n\r\n  Selection    Path            Priority  Status\r\n------------------------------------------------------------\r\n* 0            \/usr\/bin\/php7.0  70        auto mode\r\n  1            \/usr\/bin\/php5.6  56        manual mode\r\n  2            \/usr\/bin\/php7.0  70        manual mode\r\n\r\nPress  to keep the current choice[*], or type selection number: 1\r\nupdate-alternatives: using \/usr\/bin\/php5.6 to provide \/usr\/bin\/php (php) in manual mode<\/pre>\n

\u6ca1\u6709\u5176\u4ed6\u7248\u672c\u5219\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n

\u94fe\u63a5\u7ec4 php (\u63d0\u4f9b \/usr\/bin\/php)\u4e2d\u53ea\u6709\u4e00\u4e2a\u5019\u9009\u9879\uff1a\/usr\/bin\/php5.6
\n\u65e0\u9700\u914d\u7f6e\u3002<\/p>\n

\"\"<\/p>\n

\u73b0\u5728\uff0cPHP v5.6\u5df2\u88ab\u8bbe\u7f6e\u4e3aPHP\u7684\u9ed8\u8ba4\u503c\u3002<\/p>\n

\u5c31\u8fd9\u6837\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Ond\u0159ejSur\u00fd\u4e3aUbuntu\u548cDebian\u7ef4\u62a4PHP 5.6\u548cPHP 7.0\u5b58\u50a8\u5e93\u3002 \u6211\u4eec\u73b0\u5728\u5c06\u4f7f\u7528On […]<\/p>\n","protected":false},"author":310,"featured_media":169042,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-169031","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/169031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=169031"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/169031\/revisions"}],"predecessor-version":[{"id":169055,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/169031\/revisions\/169055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/169042"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=169031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=169031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=169031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}