{"id":402,"date":"2018-03-03T00:55:28","date_gmt":"2018-03-02T23:55:28","guid":{"rendered":"http:\/\/blog.chen-hongyi.com\/?p=402"},"modified":"2018-03-03T00:55:28","modified_gmt":"2018-03-02T23:55:28","slug":"%e6%8a%8a-cli-%e4%bb%8e-php7%e9%99%8d%e7%ba%a7%e5%88%b0php-6","status":"publish","type":"post","link":"https:\/\/chen-hongyi.com\/?p=402","title":{"rendered":"\u628a CLI \u4ece php7\u964d\u7ea7\u5230php.6"},"content":{"rendered":"<p><a href=\"https:\/\/askubuntu.com\/questions\/761713\/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04\">https:\/\/askubuntu.com\/questions\/761713\/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04<\/a><\/p>\n<p><strong>1. Re-Install PHP 5.6<\/strong><\/p>\n<p>What worked for me was this guide: http:\/\/www.lornajane.net\/posts\/2016\/php-7-0-and-5-6-on-ubuntu<\/p>\n<p>Actually is not required to remove php7.0, you can install php5.6 together ( also because you will have dependency problem with phpmyadmin package that required php7.0)<\/p>\n<p>Assuming libapache2-mod-php is a suitable way to enable PHP in Apache for you, you can proceed in this way:<\/p>\n<p>sudo add-apt-repository ppa:ondrej\/php<br \/>\nsudo apt-get update<br \/>\nsudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0<br \/>\n<strong>2. Switch PHP version:<\/strong><\/p>\n<p>From php5.6 to php7.0:<\/p>\n<p>Apache:<\/p>\n<p><code>sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart<\/code><br \/>\nCLI:<\/p>\n<p><code>sudo update-alternatives --set php \/usr\/bin\/php7.0<\/code><br \/>\nFrom php7.0 to php5.6:<\/p>\n<p>Apache:<\/p>\n<p><code>sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart<\/code><br \/>\nCLI:<\/p>\n<p><code>sudo update-alternatives --set php \/usr\/bin\/php5.6<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/askubuntu.com\/questions\/761713\/h &hellip; <a href=\"https:\/\/chen-hongyi.com\/?p=402\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=402"}],"version-history":[{"count":1,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":403,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions\/403"}],"wp:attachment":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}