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

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

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

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

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

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

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

全新Qwen 3.5-Plus:开源AI迈入新纪元

全新Qwen 3.5-Plus:开源AI迈入新纪元

探索阿里巴巴Qwen 3.5-Plus的革命性特性与优势,这款为开发者打造的颠覆性开源人工智能模型。

Snap 软件包:为何对 DBeaver 等高级工具力不从心

Snap 软件包:为何对 DBeaver 等高级工具力不从心

Snap包引入了限制性沙盒机制,这会破坏高级工作流程。本文解释了为何DBeaver在Snap环境下难以实现SSH隧道功能,以及为何Flatpak或原生软件包是更优的替代方案。

2026年新兴Linux趋势:塑造服务器基础设施的未来

2026年新兴Linux趋势:塑造服务器基础设施的未来

探索2026年Linux关键趋势:从Kubernetes主导地位与不可变发行版,到人工智能集成与eBPF安全技术。

Database Marketing: A Modern Approach to Customer Relationships

Database Marketing: A Modern Approach to Customer Relationships

Database marketing is essential for modern customer relationship management. Learn how strategic data use, technical expertise, and innovation drive personalized customer interactions and sustainable growth.

优化代码质量:使用ESLint与Prettier进行测试

优化代码质量:使用ESLint与Prettier进行测试

在现代软件开发中,保持一致的代码质量和风格至关重要。ESLint与Prettier提供了强大的组合方案,能够自动化这些关键环节,确保代码库的整洁性、可读性,并遵循既定标准。本文将深入探讨这两款工具如何无缝融入测试工作流,从而提升开发者的工作效率与项目的可维护性。

git-with-automatic-upload-and-synchronization-to-a-production-server

git-with-automatic-upload-and-synchronization-to-a-production-server

Google I/O 2026:反重力、AI Studio 以及向智能体开发工具的转变

Google I/O 2026:反重力、AI Studio 以及向智能体开发工具的转变

Google I/O 2026 向工程师们明确传达了一个信息:AI 工具正从自动补全迈向托管式自主执行。本文深入解析 Antigravity 2.0、Google AI Studio 不断扩展的角色、Gemini 3.5 Flash,以及在编排、锁定效应、验证和开发者工作流设计方面的实际权衡。

Google I/O 2026:架构转型、自主AI与统一生态的现实检验

Google I/O 2026:架构转型、自主AI与统一生态的现实检验

Google I/O 2026 不仅仅是一场模范活动。它展示了 Gemini 模型、开发者工具、Android 相关界面以及智能设备之间更深层次的平台变革。本文作为核心报道,为需要区分实际运行时影响与舞台炒作的技术工程师、架构师和产品团队解读这场主题演讲。

install-pcl-library-on-python-ubuntu-19-10-point-cloud-librar