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

Laravel 12 Custom CMS with Filament 3: The Expert Workflow

Laravel 12 Custom CMS with Filament 3: The Expert Workflow

A detailed look at the synergies between Laravel 12 and Filament 3 for creating customized Content Management Systems. Experts analyze the innovative workflow, advantages, disadvantages, and the challenge of the Jetstream workflow.

掌握命令行:Find命令全面指南

释放Linux find命令的全部潜能。本指南涵盖语法、扩展示例及技术细节,助您实现高效文件管理。

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

企业级多租户架构,适用于国际平台

企业级多租户架构,适用于国际平台

Loving Rocks 是一款企业级婚礼平台,采用真正的多租户架构设计,实现租户间数据库隔离,并内置国际化支持,以确保全球可扩展性、安全性及长期运营稳定性。

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

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

mozilla-thunderbird-68-x-kann-oauth2-fuer-provider-for-google-calendar-nicht-speichern

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

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

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

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,以及在编排、锁定效应、验证和开发者工作流设计方面的实际权衡。

tensorflow

tensorflow

Convert MOV to MP4 Using FFmpeg: A Simple Guide

Convert MOV to MP4 Using FFmpeg: A Simple Guide

Learn how to convert MOV videos to MP4 using FFmpeg with reliable commands, batch processing, and quality optimization for web, streaming, and cross-platform compatibility.

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

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

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

基于Next.js、Fastify、Prisma和NGINX的实用单体仓库架构

基于Next.js、Fastify、Prisma和NGINX的实用单体仓库架构

探索一种实用的单体仓库架构,结合Next.js、Fastify、Prisma与NGINX,重点展示实际集成与工作流程。