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

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.

Techniques for creating SHA512 password hashes with doveadm
Detailed guide for securely generating SHA512 password hashes from the command line using the Dovecot tool doveadm. This article is intended for system administrators and developers.

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

PostfixAdmin:企业级Postfix邮件系统管理平台 —— 2026年版
PostfixAdmin是一款以数据库为核心的邮件系统管理界面,专为专业级Postfix邮件系统设计。它并非隐藏复杂性,而是提供对域名、邮箱、别名及发件人权限的精准控制。本文将阐述为何PostfixAdmin在2026年仍是值得信赖的企业级解决方案,以及它如何融入注重安全性的现代邮件基础设施体系。

规范化架构、URL 设计、解析器逻辑、API 与可扩展性规范
面向多租户门户的地理发现架构。定义了规范化 URL、解析器逻辑、缓存策略以及不依赖 CMS 耦合或数据库重构的地理读模型。该设计旨在确保 SEO 稳定性、高可扩展性,并支持未来的功能扩展,例如预订和地图。
linux-server-webserver-git-rechteverwaltung

Mastering the SEO Workflow: Essential Optimization Strategies for Organic Growth
A structured SEO workflow is crucial for sustainable organic growth. Learn the ten foundational strategies, from keyword research and technical optimization to content quality and performance analysis.
git-with-ssh-on-windows
Using Cygwin’s bash Babun terminal in a JetBrains IDE
Using Cygwin’s bash Babun terminal in a JetBrains IDE

Boosting Productivity with ERP Systems: A Case Study on Relational Databases

Prisma 7 多数据库架构:专家深度解析
复杂数据环境的管理需要现代化的架构。Prisma 7提供多数据库集成的高级功能,并应对多语言持久化带来的挑战。

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