{"id":33275,"date":"2021-01-23T16:07:20","date_gmt":"2021-01-23T16:07:20","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=33275"},"modified":"2024-04-24T15:09:28","modified_gmt":"2024-04-24T15:09:28","slug":"install-php-8-0-pecl-extensions-ubuntu-20-04-18-04-16-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2021\/01\/install-php-8-0-pecl-extensions-ubuntu-20-04-18-04-16-04\/","title":{"rendered":"How to Install PHP 8.0 &#038; PECL Extensions in Ubuntu 20.04, 18.04, 16.04"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-33276\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/01\/php-icon.png\" alt=\"\" width=\"250\" height=\"250\" \/><\/p>\n<p>Want to install PHP 8.0 as well as many PECL extensions in your Ubuntu Server? Well there&#8217;s a well trusted PPA that contains the packages for all current Ubuntu releases.<\/p>\n<p>Ond\u0159ej Sur\u00fd, a Debian Developer who maintains the official PHP packages in Debian, is maintaining an <a href=\"https:\/\/launchpad.net\/~ondrej\/+archive\/ubuntu\/php\" target=\"_blank\" rel=\"noopener\">Ubuntu PPA<\/a> that contains the latest PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, and PHP 8.0 packages as well as PECL extensions for all current Ubuntu releases.<\/p>\n<p><b>1.)<\/b> Simply open terminal or connect to your remote Ubuntu server, and run command to make sure <code>software-properties-common<\/code> is installed:<\/p>\n<pre style=\"border: none;\">sudo apt install software-properties-common<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33282\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/01\/apt-software-propertiescommon.jpg\" alt=\"\" width=\"600\" height=\"130\" \/><\/p>\n<p><b>2.)<\/b> Then run command to add the php PPA repository by running command:<\/p>\n<pre style=\"border: none;\">sudo add-apt-repository ppa:ondrej\/php<\/pre>\n<p><i>For non-UTF-8 locales, run <code style=\"border: none; color: #000000;\">LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej\/php<\/code><\/i><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33279\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/01\/php-ppa.jpg\" alt=\"\" width=\"600\" height=\"130\" \/><\/p>\n<p><b>3.)<\/b> If you are using php-gearman, you need to run command to add the gearman PPA:<\/p>\n<pre style=\"border: none;\">sudo add-apt-repository ppa:ondrej\/pkg-gearman<\/pre>\n<p>I&#8217;m using Nginx web server, and it&#8217;s recommended to add the Nginx stable PPA instead:<\/p>\n<pre style=\"border: none;\">sudo add-apt-repository ppa:ondrej\/nginx<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33280\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/01\/nginx-ppa.jpg\" alt=\"\" width=\"600\" height=\"130\" \/><\/p>\n<p>If you&#8217;re using Apache2, adding the apache2 PPA is recommended:<\/p>\n<pre style=\"border: none;\">sudo add-apt-repository ppa:ondrej\/apache2<\/pre>\n<p><b>4.)<\/b> Finally refresh system package cache and install php 8.0 packages via command:<\/p>\n<pre style=\"border: none;\">sudo apt update\r\n\r\nsudo apt install php8.0-fpm libapache2-mod-php8.0 php8.0-mysql php8.0-xml<\/pre>\n<p>There are also many other packages available, e.g., <code style=\"border: none;\">php8.0-amqp<\/code>, <code style=\"border: none;\">php8.0-apcu<\/code>, <code style=\"border: none;\">php8.0-memcache<\/code>, <code style=\"border: none;\">php8.0-memcached<\/code>, and more. Just add or remove package names after &#8220;sudo apt install&#8221; depends what you need.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33281\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/01\/apt-php80.jpg\" alt=\"\" width=\"600\" height=\"269\" \/><\/p>\n<p>In all previous commands, <b>you can replace php8.0 with php7.4, php7.3, php7.2, php7.0, or php5.6 to install a specify version of PHP packages<\/b><\/p>\n<h3>Uninstall PHP:<\/h3>\n<p>To remove an Ubuntu PPA, add <code style=\"border: none;\">--remove<\/code> flag in adding PPA command. For instance, remove php PPA via command:<\/p>\n<pre style=\"border: none;\">sudo add-apt-repository --remove ppa:ondrej\/php<\/pre>\n<p>Instead of removing Ubuntu PPA, you can also purge PPA which also downgrade installed packages to the stock version in Ubuntu repositories.<\/p>\n<pre style=\"border: none;\">sudo apt install ppa-purge &amp;&amp; sudo ppa-purge ppa:ondrej\/php<\/pre>\n<p>To remove a php package, simply run command:<\/p>\n<pre style=\"border: none;\">sudo apt remove Package_Name_Here<\/pre>","protected":false},"excerpt":{"rendered":"<p>Want to install PHP 8.0 as well as many PECL extensions in your Ubuntu Server? Well there&#8217;s a well trusted PPA that contains the packages for all current Ubuntu releases. Ond\u0159ej Sur\u00fd, a Debian Developer who maintains the official PHP packages in Debian, is maintaining an Ubuntu PPA that contains the latest PHP 5.6, PHP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[746],"class_list":["post-33275","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-php"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/33275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=33275"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/33275\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=33275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=33275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=33275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}