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

ZBT Z8102AX 双SIM卡故障切换:有效功能、缺失功能及固件需改进之处
ZBT Z8102AX是一款双SIM卡5G OpenWrt路由器,但仅具备双SIM卡硬件并不等同于智能故障切换。该路由器能识别SIM卡并成功连接,但自动切换、调制解调器恢复、基于信号的决策以及清晰的故障切换逻辑仍需更深入的测试。

Google I/O 2026:搜索、工作空间和购物中的智能代理产品
Google I/O 2026 展示了代理型 AI 正从模型演示和开发者工具走向日常产品界面。本文解析了搜索、Workspace、Gemini Spark 和 Universal Cart 如何指向一种新的产品模式——谷歌代理帮助用户在互联服务中研究、工作、购物和行动。

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.

Fedora 43上的ComfyUI:双虚拟环境 + 一键启动(2026年3月)
目标:保留两个Python虚拟环境(例如3.12和3.14)以确保兼容性,但通过一个简洁、轻量的配置自动启动ComfyUI。

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

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

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.

2026年新兴Linux趋势:塑造服务器基础设施的未来
探索2026年Linux关键趋势:从Kubernetes主导地位与不可变发行版,到人工智能集成与eBPF安全技术。

下一代OpenWrt 5G路由器:为何Wi-Fi 7、更强CPU与更优固件至关重要
ZBT Z8102AX 是一个有用的初步样品,但下一步应该更强:Wi-Fi 7、更强大的四核平台、更清晰的固件、改进的包装以及更稳定的定价策略。目标不仅仅是另一款5G路由器,而是一款配置更优、基于OpenWrt的准专业级设备。

Enterprise Start Here: Your Gateway to Operational Excellence
New to our enterprise platform? This guide provides a structured onboarding path, from foundational reference models to actionable playbooks, runbooks, and assessments designed for seamless implementation.

Database Marketing – Modern Approach for Customer Relationships
Modern overview of database marketing: from data strategy and technical architecture to automation, GDPR and best practices for sustainable customer relationships.