How to Install PHP 8.3 on Ubuntu 22.04

Up-to-date guide on installing PHP 8.3 on Ubuntu 22.04, including Apache and Nginx (PHP-FPM) integration, extensions, and running multiple PHP versions side by side.
已发布:
Aleksandar Stajić
Updated: 2026年1月9日 00:16
How to Install PHP 8.3 on Ubuntu 22.04

How to Install PHP 8.3 on Ubuntu 22.04

This guide shows how to properly install and run PHP 8.3 on Ubuntu 22.04 in a modern server environment. It covers system preparation, repository setup, Apache and Nginx integration, PHP extensions, version switching and common best practices.

Step 1: Update the Operating System

Before installing PHP, make sure your system is fully up to date. This prevents dependency conflicts and ensures security patches are applied.

sudo apt update && sudo apt upgrade -y

Step 2: Add the PHP Repository

Ubuntu 22.04 does not ship PHP 8.3 by default. The widely used and trusted Ondřej Surý repository provides up-to-date PHP versions and extensions.

sudo apt install -y ca-certificates apt-transport-https software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Step 3: Install PHP 8.3 (CLI)

Install the PHP 8.3 core package. This provides the PHP CLI and the base runtime required by web servers and background tasks.

sudo apt install -y php8.3

Verify the installed PHP version:

php -v

Step 4: Install PHP 8.3 for Apache

If you are using Apache, install PHP as an Apache module. This setup is common for traditional LAMP stacks.

sudo apt install -y libapache2-mod-php8.3

Restart Apache to activate the PHP module:

sudo systemctl restart apache2

Step 5: Install PHP 8.3 FPM for Nginx

For Nginx-based setups, PHP must run via PHP-FPM. This approach offers better performance and scalability.

sudo apt install -y php8.3-fpm

Check that the PHP-FPM service is running:

systemctl status php8.3-fpm

Step 6: Install Common PHP Extensions

Most applications require additional PHP extensions. Install only what your project actually needs to keep the system lean and secure.

sudo apt install -y php8.3-mysql php8.3-curl php8.3-xml php8.3-mbstring php8.3-zip php8.3-intl php8.3-gd php8.3-opcache

List all loaded PHP modules:

php -m

Step 7: Run Multiple PHP Versions Side-by-Side

Ubuntu allows multiple PHP versions to coexist. This is useful when maintaining legacy applications while deploying new projects on PHP 8.3.

sudo update-alternatives --config php

You can also set a specific PHP version directly:

sudo update-alternatives --set php /usr/bin/php8.3

Step 8: Recommended Post-Installation Checks

After installation, it is recommended to verify PHP configuration files, confirm the correct PHP-FPM socket or port for your web server, and ensure OPcache is enabled for production environments.

For production systems, always review php.ini settings such as memory limits, execution time, upload size and error handling according to your application requirements.

Conclusion

Installing PHP 8.3 on Ubuntu 22.04 provides a modern, stable and performant foundation for web applications. Whether you run Apache or Nginx, a clean PHP setup with the right extensions and version management ensures long-term maintainability and smooth operation.

Related Articles

搜索引擎优化:实现顶级排名的可靠工作流程

搜索引擎优化:实现顶级排名的可靠工作流程

搜索引擎优化(SEO)的详细分析,包括其技术基础、网络爬虫的作用,以及实现有机搜索排名前列的战略步骤。

erstellen-eines-benutzerdefinierten-gpt-4-plugins-in-wordpress

erstellen-eines-benutzerdefinierten-gpt-4-plugins-in-wordpress

konvertieren-rpm-in-debian-ubuntu-deb-format-debian-package-manager

HEIC转JPG转换:为何值得考虑及其工作原理

HEIC转JPG转换:为何值得考虑及其工作原理

HEIC格式提供了现代化的图像压缩和高画质,但JPG仍是兼容性最广的格式。本指南将说明在Linux环境下,何时以及如何利用工具与自动化流程将HEIC转换为JPG格式。

installation-apache-solr-7-6-0-auf-ubuntu-18-04-lts-und-18-10

Google I/O 2026:Android XR、智能眼镜与环境AI界面

Google I/O 2026:Android XR、智能眼镜与环境AI界面

Google I/O 2026 将 Android XR 和智能眼镜从概念推向实际平台方向。本文解析了音频眼镜、显示眼镜、Gemini 驱动的上下文感知、开发者影响、隐私风险,以及为何可穿戴 AI 更关乎创造环境辅助界面,而非取代手机。

ZBT Z8102AX 5G OpenWrt路由器评测:双SIM卡、RM500U-EA及真实评估

ZBT Z8102AX 5G OpenWrt路由器评测:双SIM卡、RM500U-EA及真实评估

ZBT Z8102AX是一款独特的5G路由器,采用OpenWrt基础系统、双SIM卡设计以及Quectel RM500U-EA调制解调器。在测试中,它在灵活性、接口和移动连接方面展现出明显优势,但也暴露出厂商定制版OpenWrt固件的典型缺陷。

Remove Duplicate APT Package Sources: Expert Guide for Ubuntu and Debian

Remove Duplicate APT Package Sources: Expert Guide for Ubuntu and Debian

A detailed guide for identifying and removing redundant or duplicate APT package sources in Debian and Ubuntu systems to ensure stability and performance.

Google I/O 2026:Gemini Omni、Gemini 3.5 以及驱动自主式AI的计算层

Google I/O 2026:Gemini Omni、Gemini 3.5 以及驱动自主式AI的计算层

Google I/O 2026 将 Gemini Omni 和 Gemini 3.5 置于谷歌代理型 AI 战略的核心。本文解析了多模态创作与行动级智能之间的区别,阐释了 Gemini 3.5 Flash 对代理和编码的重要性,以及这些模型如何驱动更广泛的 Google I/O 2026 平台转型。

PostgreSQL 14 Ubuntu Server 23.04

PostgreSQL 14 Ubuntu Server 23.04

ZBT Z8102AX OpenWrt 21.02 固件评测:足够稳定,但能否面向未来?

ZBT Z8102AX OpenWrt 21.02 固件评测:足够稳定,但能否面向未来?

ZBT Z8102AX 运行的是厂商修改版 OpenWrt 21.02 固件,内核版本为 5.4.246。实际测试中,该固件运行稳定,可保持路由器连续数日正常工作,但老旧的基础版本引发了关于安全性、调制解调器控制、升级路径及长期可维护性的重要问题。

installation-mod_wsgi-auf-ubuntu-80-04-python-apache-2-4-und-django