{"id":2468,"date":"2018-09-21T09:06:14","date_gmt":"2018-09-21T03:36:14","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2468"},"modified":"2026-09-28T17:24:00","modified_gmt":"2026-09-28T11:54:00","slug":"how-to-upgrade-from-php-7-0-to-php-7-1-on-ubuntu","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-upgrade-from-php-7-0-to-php-7-1-on-ubuntu\/","title":{"rendered":"How to upgrade from PHP 7.0 to PHP 7.1 on Ubuntu"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date:<\/strong> September 21, 2018 <br><strong>Last Updated:<\/strong> September 23, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to upgrade your PHP version on Ubuntu using the <code>ondrej\/php<\/code> PPA. The original version of this guide covered upgrading PHP 7.0 to 7.1 \u2014 both long past end-of-life at this point. The process below is the same regardless of which versions you&#8217;re moving between; use whatever current PHP version your applications actually require rather than these old version numbers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu server with an existing PHP version installed<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>Knowledge of which PHP version your applications require<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>ondrej\/php<\/code> PPA lets <strong>multiple PHP versions coexist side by side<\/strong> on the same system, each installed under its own version-specific path<\/li>\n\n\n\n<li>Only one version is <strong>active<\/strong> at a time for the web server, controlled by which Apache module is enabled (<code>mod_php<\/code>) or which PHP-FPM pool Nginx is pointed at<\/li>\n\n\n\n<li>Installing a new version&#8217;s packages does <strong>not<\/strong> automatically switch which version is active \u2014 that&#8217;s a separate step<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM-1024x683.png\" alt=\"\" class=\"wp-image-11894\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM-1024x683.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM-300x200.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM-768x512.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM-272x182.png 272w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/09\/ChatGPT-Image-Sep-23-2026-04_44_45-PM.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is the step the original guide left out entirely \u2014 installing PHP 7.1&#8217;s packages alongside 7.0 doesn&#8217;t actually make the server start using it, which Step 5 below covers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Add the ondrej\/php PPA<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo add-apt-repository ppa:ondrej\/php\nsudo apt-get update\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>add-apt-repository<\/code> isn&#8217;t found:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get install software-properties-common\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original guide also referenced <code>python-software-properties<\/code>, an old package name from much earlier Ubuntu releases. It&#8217;s no longer available or needed on current Ubuntu versions \u2014 <code>software-properties-common<\/code> alone provides <code>add-apt-repository<\/code>.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. List Your Current PHP Packages<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dpkg -l | grep php | tee packages.txt\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This gives you a reference list of exactly what&#8217;s currently installed, useful for knowing which extension packages to reinstall for the new version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Stop the Web Server and Install the New PHP Version<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl stop apache2\nsudo apt-get install php&lt;NEW_VERSION> php&lt;NEW_VERSION>-common\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>&lt;NEW_VERSION&gt;<\/code> with your actual target version (e.g., <code>8.3<\/code>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Install the Extensions You Need<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Match these against the list from Step 2:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get install php&lt;NEW_VERSION>-curl php&lt;NEW_VERSION>-xml php&lt;NEW_VERSION>-zip php&lt;NEW_VERSION>-gd php&lt;NEW_VERSION>-mysql php&lt;NEW_VERSION>-mbstring\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Switch the Active PHP Version<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This step was missing from the original guide, but it&#8217;s essential \u2014 without it, your web server keeps using the old version even after the new one is installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If using Apache with mod_php:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo a2dismod php&lt;OLD_VERSION>\nsudo a2enmod php&lt;NEW_VERSION>\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If using PHP-FPM (with Apache or Nginx):<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Update your web server&#8217;s config to point at the new version&#8217;s FPM socket, typically something like <code>\/run\/php\/php&lt;NEW_VERSION&gt;-fpm.sock<\/code> instead of the old version&#8217;s socket path, then restart PHP-FPM:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl restart php&lt;NEW_VERSION>-fpm\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For the CLI version<\/strong> (used when running <code>php<\/code> from the command line):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo update-alternatives --set php \/usr\/bin\/php&lt;NEW_VERSION>\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Remove the Old Version<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;ve confirmed everything works on the new version:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get purge php&lt;OLD_VERSION> php&lt;OLD_VERSION>-common\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Start the Web Server and Verify<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl start apache2\nphp -v\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm the version shown matches your target version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Upgrading PHP on Ubuntu with the <code>ondrej\/php<\/code> PPA is straightforward, but the critical step a lot of quick guides skip is actually switching the <em>active<\/em> version \u2014 via <code>a2dismod<\/code>\/<code>a2enmod<\/code> for Apache&#8217;s mod_php, updating the FPM socket path for PHP-FPM setups, or <code>update-alternatives<\/code> for the CLI. Installing the new packages alone isn&#8217;t enough.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why is my site still showing the old PHP version after installing the new one?<\/strong> This is almost always Step 5 being skipped \u2014 the new version&#8217;s packages were installed, but the web server (or CLI) was never actually switched over to use it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Can I run two PHP versions at the same time for different sites?<\/strong> Yes \u2014 this is exactly what the <code>ondrej\/php<\/code> PPA is designed for. Different Apache virtual hosts or Nginx server blocks can each point at a different PHP-FPM pool\/socket, running different versions side by side.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Should I test the new PHP version before removing the old one?<\/strong> Yes \u2014 test your applications thoroughly on the new version first, since PHP version upgrades can introduce breaking changes for older code. Keep the old version installed until you&#8217;re confident everything works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/goals-of-setting-up-of-apachephpmysql-on-macos\/\">Goals of setting up of Apache,PHP,MySQL and Magento on macOS<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/managing-multiple-php-versions-on-ubuntu-using-apt\/\">Managing Multiple PHP Versions on Ubuntu Using APT<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Managing PHP versions across your servers or planning an application upgrade? Our team can help with PHP migrations, server configuration, and ongoing support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: September 21, 2018 Last Updated: September 23, 2026 Introduction This guide explains how to upgrade your PHP version [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[417,418,419],"class_list":["post-2468","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-php-7-0","tag-php-7-1","tag-upgrade-php","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-DO","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2468"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2468\/revisions"}],"predecessor-version":[{"id":11958,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2468\/revisions\/11958"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}