{"id":203,"date":"2023-10-25T20:47:56","date_gmt":"2023-10-25T16:47:56","guid":{"rendered":"http:\/\/keksus.com\/?p=203"},"modified":"2025-01-05T21:52:39","modified_gmt":"2025-01-05T17:52:39","slug":"upgrade-php5-to-php7-1-on-debian","status":"publish","type":"post","link":"https:\/\/hostatto.com\/blog\/upgrade-php5-to-php7-1-on-debian.html","title":{"rendered":"Upgrade php5 to php7.1 on  Debian"},"content":{"rendered":"<p>To install php7.1 you don't need to delete php5. PHP 7.1 will be installed in a separate folder \/etc\/php\/7.1\/<br \/>\nFirst add Dotdeb PPA and import the GPG key of Dotdeb repository<\/p>\n<blockquote><p>apt-get install apt-transport-https lsb-release ca-certificates<br \/>\nwget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg<\/p><\/blockquote>\n<p>Then add PPA in your server and update<\/p>\n<blockquote><p>echo 'deb https:\/\/packages.sury.org\/php\/ jessie main' &gt; \/etc\/apt\/sources.list.d\/php.list<br \/>\napt-get update<\/p><\/blockquote>\n<p>Let's see what php7.1 packages there are for installation<\/p>\n<blockquote><p>apt-cache search php7.1<\/p><\/blockquote>\n<p>Select the packages you need and install<\/p>\n<blockquote><p>apt-get install -y php7.1-fpm php7.1-cli php7.1-curl php7.1-mysql php7.1-sqlite3 php7.1-gd php7.1-xml php7.1-mcrypt php7.1-mbstring php7.1-iconv php7.1-cgi php7.1-json<\/p><\/blockquote>\n<p>Now open php.ini file<\/p>\n<blockquote><p>nano \/etc\/php\/7.1\/fpm\/php.ini<\/p><\/blockquote>\n<p>and set<\/p>\n<blockquote><p>cgi.fix_pathinfo=0<\/p><\/blockquote>\n<p>Save and restart php-fpm<\/p>\n<blockquote><p>service php7.1-fpm restart<\/p><\/blockquote>\n<p>Now change NGINX settings. In all files where you include php5-fpm, replace<\/p>\n<blockquote><p>fastcgi_pass unix:\/var\/run\/php5-fpm.sock;<\/p><\/blockquote>\n<p>to<\/p>\n<blockquote><p>fastcgi_pass unix:\/run\/php\/php7.1-fpm.sock;<\/p><\/blockquote>\n<p>Save and restart NGINX<\/p>\n<blockquote><p>service nginx restart<\/p><\/blockquote>\n<p>Check installed php version. Create file serverinfo.php and write<\/p>\n<blockquote><p>php -v<\/p><\/blockquote>\n<p>Now you have two worked php versions. Check it.<\/p>\n<blockquote><p>ps aux | grep php<\/p><\/blockquote>\n<p>If you don't plan use php5, you can stop it<\/p>\n<blockquote><p>service php5-fpm stop<\/p><\/blockquote>\n<p>To completely remove php5, run commands<\/p>\n<blockquote><p>apt-get purge php5-common<br \/>\napt-get purge 'php5*'<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>...<\/p>\n","protected":false},"author":1,"featured_media":206,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,24],"tags":[21,19,20,22],"class_list":["post-203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-php","tag-debian","tag-php","tag-php7","tag-server"],"_links":{"self":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":0,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media\/206"}],"wp:attachment":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}