{"id":43435,"date":"2022-12-09T16:44:55","date_gmt":"2022-12-09T16:44:55","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=43435"},"modified":"2022-12-09T16:44:55","modified_gmt":"2022-12-09T16:44:55","slug":"php-8-2-ubuntu-ppa","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2022\/12\/php-8-2-ubuntu-ppa\/","title":{"rendered":"PHP 8.2 Released, How to Install in Ubuntu 22.04 | 20.04 via PPA"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-43436\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo-600x600.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-logo.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>PHP finally released 8.2.0 release after 7 release candidates. Here are the new features and how to install guide for all current Ubuntu LTS.<\/p>\n<p>PHP 8.2.0 allows to <b>mark a class as readonly<\/b>, which will add the readonly modifier to every declared property, and prevent the creation of dynamic properties. Moreover, using the AllowDynamicProperties attribute on readonly class will trigger a compile-time error.<\/p>\n<p>Other release highlights in PHP 8.2.0 include:<\/p>\n<ul>\n<li>Disjunctive Normal Form (DNF) Types<\/li>\n<li>New stand-alone types: null, false, and true<\/li>\n<li>New &#8220;Random&#8221; extension<\/li>\n<li>Constants in traits<\/li>\n<li>Deprecate dynamic properties<\/li>\n<\/ul>\n<p>There are as well numerous bug-fixes and other changes in the release. See <a href=\"https:\/\/www.php.net\/ChangeLog-8.php#8.2.0\" target=\"_blank\" rel=\"noopener\">the changelog<\/a> for details.<\/p>\n<h3>How to Install Php 8.2 in Ubuntu:<\/h3>\n<p><b><i>Not recommended for beginners. Only install PHP 8.2 for web developing purpose or there&#8217;s specific feature or bug-fix you need in this release.<\/i><\/b><\/p>\n<p>The popular <a href=\"https:\/\/launchpad.net\/~ondrej\/+archive\/ubuntu\/php\/\" target=\"_blank\" rel=\"noopener\">Ond\u0159ej Sur\u00fd&#8217;s PPA<\/a> has built the package for all current Ubuntu LTS: Ubuntu 18.04, Ubuntu 20.04 and Ubuntu 22.04.<\/p>\n<p>1. First, open terminal or connect to your Ubuntu server and run command to add the PPA:<\/p>\n<pre>LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej\/php<\/pre>\n<p>Run <code>sudo apt install software-properties-common<\/code> in case the command does not exist. And, type user password (no asterisk feedback) when it asks and hit Enter to continue.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-unofficial-ppa.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-43437\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-unofficial-ppa-600x415.webp\" alt=\"\" width=\"600\" height=\"415\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-unofficial-ppa-600x415.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-unofficial-ppa-300x208.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/php-unofficial-ppa.webp 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>2. Then, install Php packages accordingly. For example, install apache2 module and mysql module via command:<\/p>\n<pre>sudo apt install php8.2 libapache2-mod-php8.2 php8.2-mysql<\/pre>\n<p>Or install the FPM-CGI binary for use with Nginx:<\/p>\n<pre>sudo apt install php8.2 php8.2-fpm php8.2-mysql<\/pre>\n<p><i>For <b>Ubuntu 18.04<\/b>, run <code>sudo apt update<\/code> first to refresh package cache.<\/i><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/apt-php82.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-43438\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/apt-php82-600x323.webp\" alt=\"\" width=\"600\" height=\"323\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/apt-php82-600x323.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/apt-php82-300x162.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/12\/apt-php82.webp 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>After installed it, remember to configure your http server (apache 2 or nginx) for the new PHP package, and configure php8.2 via files under &#8216;\/etc\/php\/8.2\/&#8217;.<\/p>\n<h3>Uninstall Php 8.2<\/h3>\n<p>To remove the package, simply run command:<\/p>\n<pre>sudo apt remove --autoremove php8.2 libapache2-mod-php8.2 php8.2-*<\/pre>\n<p>And remove the Ubuntu PPA via command:<\/p>\n<pre>sudo add-apt-repository --remove ppa:ondrej\/php<\/pre>","protected":false},"excerpt":{"rendered":"<p>PHP finally released 8.2.0 release after 7 release candidates. Here are the new features and how to install guide for all current Ubuntu LTS. PHP 8.2.0 allows to mark a class as readonly, which will add the readonly modifier to every declared property, and prevent the creation of dynamic properties. Moreover, using the AllowDynamicProperties attribute [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":43436,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2057],"class_list":["post-43435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-web"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/43435","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=43435"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/43435\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/43436"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=43435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=43435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=43435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}