Other Tutorials<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\nInstalling PHP 8.x on Ubuntu 22.04<\/h2>\n\n\n\n
The default Ubuntu 22.04 repositories provide upto PHP 8.1 packages as of this writing;<\/p>\n\n\n\n
apt-cache policy php8*<\/code><\/pre>\n\n\n\nSample output;<\/p>\n\n\n\n
php8.0-pdo-pgsql:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-enchant:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-pdo-firebird:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-simplexml:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-mysqlnd:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pspell:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-raphf:\n Installed: (none)\n Candidate: 2.0.1+1.1.2-13\n Version table:\n 2.0.1+1.1.2-13 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-interbase:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-bcmath:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-simplexml:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-ctype:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pgsql:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-enchant:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-interbase:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-iconv:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sass:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-msgpack:\n Installed: (none)\n Candidate: 2.2.0~rc1+2.1.2+0.5.7-6\n Version table:\n 2.2.0~rc1+2.1.2+0.5.7-6 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-gmagick:\n Installed: (none)\n Candidate: 2.0.6~rc1+1.1.7~rc3-10\n Version table:\n 2.0.6~rc1+1.1.7~rc3-10 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-pdo-mysql:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-snmp:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-soap:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-snmp:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-pdo-mysql:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-soap:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-pdo-sqlite:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-solr:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pdo-sqlite:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-http:\n Installed: (none)\n Candidate: 4.0.0+3.2.4+2.6.0-0+deb11u1ubuntu1\n Version table:\n 4.0.0+3.2.4+2.6.0-0+deb11u1ubuntu1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-yaml:\n Installed: (none)\n Candidate: 2.2.2+2.1.0+2.0.4+1.3.2-5\n Version table:\n 2.2.2+2.1.0+2.0.4+1.3.2-5 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-ssh2:\n Installed: (none)\n Candidate: 1.3.1+0.13-6\n Version table:\n 1.3.1+0.13-6 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-common:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-curl:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-opcache:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-smbclient:\n Installed: (none)\n Candidate: 1.0.6-6\n Version table:\n 1.0.6-6 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-imagick:\n Installed: (none)\n Candidate: 3.6.0-4\n Version table:\n 3.6.0-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-mysql:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-mailparse:\n Installed: (none)\n Candidate: 3.1.2+2.1.7~dev20160128-7\n Version table:\n 3.1.2+2.1.7~dev20160128-7 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-tidy:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-curl:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-imap:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-intl:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main i386 Packages\nphp8.1:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main i386 Packages\nphp8.1-shmop:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-tidy:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-odbc:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-imap:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-phpdbg:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-intl:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-calendar:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-mysqli:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-opcache:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-odbc:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-gd:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-sybase:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-mysqli:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-memcache:\n Installed: (none)\n Candidate: 8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-7\n Version table:\n 8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-7 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-mbstring:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-xmlreader:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-ctype:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-memcached:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-pgsql:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-calendar:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-json:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-iconv:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-fileinfo:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-posix:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-phar:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-uopz:\n Installed: (none)\n Candidate: 7.1.1+6.1.2-2ubuntu1\n Version table:\n 7.1.1+6.1.2-2ubuntu1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-common:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-xmlrpc:\n Installed: (none)\n Candidate: 3:1.0.0~rc3-2\n Version table:\n 3:1.0.0~rc3-2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-json:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pcov:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-mongodb:\n Installed: (none)\n Candidate: 1.12.0+1.9.2+1.7.5-4\n Version table:\n 1.12.0+1.9.2+1.7.5-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-readline:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-gettext:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-uuid:\n Installed: (none)\n Candidate: 1.2.0-11\n Version table:\n 1.2.0-11 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-phar:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pdo-dblib:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sockets:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-ds:\n Installed: (none)\n Candidate: 1.4.0-4\n Version table:\n 1.4.0-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-gd:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-ps:\n Installed: (none)\n Candidate: 1.4.4+1.3.7-6\n Version table:\n 1.4.4+1.3.7-6 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-igbinary:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-exif:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-mbstring:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-pdo-dblib:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-xmlreader:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-phpdbg:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-exif:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-fileinfo:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-gettext:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-redis:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sqlite3:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-mysql:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-xmlwriter:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-sockets:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-pspell:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-readline:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-bcmath:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-sysvmsg:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-shmop:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-gearman:\n Installed: (none)\n Candidate: 2.1.0+1.1.2-11\n Version table:\n 2.1.0+1.1.2-11 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-sysvsem:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-sysvshm:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sybase:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-bz2:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-tokenizer:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-cgi:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-cli:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-dba:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-dev:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-dom:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-ldap:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-pdo-odbc:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-sqlite3:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-ffi:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-fpm:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-ftp:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-ast:\n Installed: (none)\n Candidate: 1.0.16-4\n Version table:\n 1.0.16-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-gmp:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-bz2:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-cgi:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-cli:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-dba:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-dev:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-dom:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-ffi:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-fpm:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-ftp:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-ldap:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-gmp:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-pdo:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sysvmsg:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-xmlwriter:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-amqp:\n Installed: (none)\n Candidate: 1.11.0-4\n Version table:\n 1.11.0-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-pdo:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-psr:\n Installed: (none)\n Candidate: 1.2.0-4\n Version table:\n 1.2.0-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-sysvsem:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-sysvshm:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-apcu:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-rrd:\n Installed: (none)\n Candidate: 2.0.3+1.1.3-6\n Version table:\n 2.0.3+1.1.3-6 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-xml:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.0-xsl:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe i386 Packages\nphp8.1-xdebug:\n Installed: (none)\n Candidate: 3.1.2+2.9.8+2.8.1+2.5.5-4\n Version table:\n 3.1.2+2.9.8+2.8.1+2.5.5-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-mysqlnd:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-zip:\n Installed: (none)\n Candidate: 8.0.8-1ubuntu2\n Version table:\n 8.0.8-1ubuntu2 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-pdo-pgsql:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-xml:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-xsl:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main i386 Packages\nphp8.1-yac:\n Installed: (none)\n Candidate: 2.3.1+0.9.2-4\n Version table:\n 2.3.1+0.9.2-4 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.1-zip:\n Installed: (none)\n Candidate: 8.1.0-1\n Version table:\n 8.1.0-1 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/main amd64 Packages\nphp8.1-zmq:\n Installed: (none)\n Candidate: 1.1.3-23\n Version table:\n 1.1.3-23 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\nphp8.0-pdo-odbc:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-tokenizer:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-pdo-firebird:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.0-posix:\n Installed: (none)\n Candidate: (none)\n Version table:\nphp8.1-oauth:\n Installed: (none)\n Candidate: 2.0.7+1.2.3-14\n Version table:\n 2.0.7+1.2.3-14 500\n 500 http:\/\/us.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\nInstall PHP 8.0 on Ubuntu 22.04<\/h3>\n\n\n\n
Thus, to install PHP 8.0 on Ubuntu 22.04, run the command;<\/p>\n\n\n\n
apt install php8.0<\/code><\/pre>\n\n\n\nThis command will install PHP 8.0 along with other required package dependencies as seen from the output below.<\/p>\n\n\n\n
Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php8.0 libapr1\n libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php8.0-cli\n php8.0-common php8.0-opcache php8.0-readline\nSuggested packages:\n apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser\n php-pear\nThe following NEW packages will be installed:\n apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php8.0 libapr1\n libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php8.0\n php8.0-cli php8.0-common php8.0-opcache php8.0-readline\n0 upgraded, 15 newly installed, 0 to remove and 727 not upgraded.\nNeed to get 6,628 kB of archives.\nAfter this operation, 27.7 MB of additional disk space will be used.\nDo you want to continue? [Y\/n] y\n<\/code><\/pre>\n\n\n\nTo install any other PHP 8.0 extensions, simply run the command below;<\/p>\n\n\n\n
apt install php8.0-Extension<\/code><\/pre>\n\n\n\nWhere Extension is the name of the respective extension that you want to install. For example;<\/p>\n\n\n\n
apt install php8.0-snmp<\/code><\/pre>\n\n\n\nInstall PHP 8.1 on Ubuntu 22.04<\/h3>\n\n\n\n
You can now install PHP 8.1 and any required extension on Ubuntu 22.04, run the command below;<\/p>\n\n\n\n
apt install php8.1<\/code><\/pre>\n\n\n\nThis command will install PHP 8.1 along with other required package dependencies as seen from the output below.<\/p>\n\n\n\n
Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php8.1 libapr1\n libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php8.1-cli\n php8.1-common php8.1-opcache php8.1-readline\nSuggested packages:\n apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser\n php-pear\nThe following NEW packages will be installed:\n apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php8.1 libapr1\n libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php8.1\n php8.1-cli php8.1-common php8.1-opcache php8.1-readline\n0 upgraded, 15 newly installed, 0 to remove and 727 not upgraded.\nNeed to get 7,012 kB of archives.\nAfter this operation, 28.9 MB of additional disk space will be used.\nDo you want to continue? [Y\/n] y\n<\/code><\/pre>\n\n\n\nTo install any other PHP 8.1 extensions\/modules, simply run the command below;<\/p>\n\n\n\n
apt install php8.1-Extension<\/code><\/pre>\n\n\n\nReplace Extension<\/strong> with the specific module\/extension. For example;<\/p>\n\n\n\napt install php8.1-mysql php8.1-xml<\/code><\/pre>\n\n\n\nInstall PHP 8.2 on Ubuntu 22.04<\/h3>\n\n\n\n
As of this writing, default Ubuntu 22.04 repositories doesn’t have PHP 8.2 packages.<\/p>\n\n\n\n
Thus, you need to install Andrej SURY APT repository on Ubuntu 22.04;<\/p>\n\n\n\n
add-apt-repository ppa:ondrej\/php --yes<\/code><\/pre>\n\n\n\nYou can then install PHP 8.2 and any required extension on Ubuntu 22.04;<\/p>\n\n\n\n
apt install php8.2<\/code><\/pre>\n\n\n\nThis command will install PHP 8.2 along with other required package dependencies.<\/p>\n\n\n\n
To install any other PHP 8.2 extensions\/modules, simply run the command below;<\/p>\n\n\n\n
apt install php8.2-Extension<\/code><\/pre>\n\n\n\nReplace Extension<\/strong> with the specific module\/extension. For example;<\/p>\n\n\n\napt install php8.2-mysql php8.2-xml<\/code><\/pre>\n\n\n\nCheck version of PHP Installed<\/h3>\n\n\n\n
You can check the version of PHP installed using the command;<\/p>\n\n\n\n
php -v<\/code><\/pre>\n\n\n\n\nPHP 8.2.4 (cli) (built: Mar 16 2023 14:34:48) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.4, Copyright (c) Zend Technologies\n with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies\n<\/code><\/pre>\n\n\n\nHow to Set Default PHP Version on Debian<\/h2>\n\n\n\n
You can set the default PHP version using the update-alternatives<\/code> command.<\/p>\n\n\n\nIf you have multiple versions of PHP installed, there could be some situations that might make you choose a default version to use.<\/p>\n\n\n\n
You can list the paths of the installed PHP versions by running the command update-alternatives --list php<\/code>.<\/p>\n\n\n\nupdate-alternatives --list php<\/code><\/pre>\n\n\n\nSample output;<\/p>\n\n\n\n
\/usr\/bin\/php8.0\n\/usr\/bin\/php8.1\n\/usr\/bin\/php8.2<\/code><\/pre>\n\n\n\nThus, to set the default PHP version, you can use the update-alternatives<\/code> command with the --config<\/code> option followed by the path of the desired PHP version. For example, to set PHP version 8.1 as the default PHP version, run the command;<\/p>\n\n\n\nupdate-alternatives --config php \/usr\/bin\/php8.1<\/code><\/pre>\n\n\n\nYou can also run the command interactively by omitting the path to PHP;<\/p>\n\n\n\n
update-alternatives --config php<\/code><\/pre>\n\n\n\n\nThere are 3 choices for the alternative php (providing \/usr\/bin\/php).\n\n Selection Path Priority Status\n------------------------------------------------------------\n* 0 \/usr\/bin\/php8.2 82 auto mode\n 1 \/usr\/bin\/php8.0 80 manual mode\n 2 \/usr\/bin\/php8.1 81 manual mode\n 3 \/usr\/bin\/php8.2 82 manual mode\n\nPress <enter> to keep the current choice[*], or type selection number:\n<\/code><\/pre>\n\n\n\nTo set a specific version of PHP as the default version, simply choose a number and press ENTER.<\/p>\n\n\n\n
For example, in the above prompt, you can enter 2 and press ENTER to set PHP 8.1 as the default version;<\/p>\n\n\n\n
\nThere are 3 choices for the alternative php (providing \/usr\/bin\/php).\n\n Selection Path Priority Status\n------------------------------------------------------------\n* 0 \/usr\/bin\/php8.2 82 auto mode\n 1 \/usr\/bin\/php8.0 80 manual mode\n 2 \/usr\/bin\/php8.1 81 manual mode\n 3 \/usr\/bin\/php8.2 82 manual mode\n\nPress <enter> to keep the current choice[*], or type selection number: 2\nupdate-alternatives: using \/usr\/bin\/php8.1 to provide \/usr\/bin\/php (php) in manual mode\n<\/code><\/pre>\n\n\n\nConfirm the version;<\/p>\n\n\n\n
PHP 8.1.17 (cli) (built: Mar 16 2023 14:37:38) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.17, Copyright (c) Zend Technologies\n with Zend OPcache v8.1.17, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\nThat is all on how to install PHP 8.x on Ubuntu 22.04.<\/p>\n\n\n\n
Other Tutorials<\/h2>\n\n\n\n
Install PHP 7.1\/7.2\/7.3\/7.4 on Debian 11<\/a><\/p>\n\n\n\nInstall phpLDAPAdmin on Debian 10\/Debian 11<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"In this tutorial, you will learn how to install PHP 8.0\/8.1\/8.2\/8.x on Ubuntu 22.04. PHP 8 is a major update of the PHP language. It contains many<\/p>\n","protected":false},"author":1,"featured_media":10159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,342],"tags":[4436,4442],"class_list":["post-11297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-php","tag-install-php-8-0-ubuntu-22-04","tag-install-php-8-1-ubuntu-22-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11297"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=11297"}],"version-history":[{"count":7,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11297\/revisions"}],"predecessor-version":[{"id":21314,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11297\/revisions\/21314"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/10159"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=11297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=11297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=11297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}