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

Welcome to NuxtWP Multilang Theme
Introduction to the NuxtWP Multilang Theme - a modern multilingual CMS built with Nuxt 4.
掌握命令行:Find命令全面指南
释放Linux find命令的全部潜能。本指南涵盖语法、扩展示例及技术细节,助您实现高效文件管理。

全新Qwen 3.5-Plus:开源AI迈入新纪元
探索阿里巴巴Qwen 3.5-Plus的革命性特性与优势,这款为开发者打造的颠覆性开源人工智能模型。
javascript-batchverarbeitung-oder-stapelverarbeitung-von-function

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

Qwen 3.6 生产环境部署:发布手册、AI 回滚与 LLMOps 版本管理
Qwen 3.6 不仅仅是一次模型升级。它同时是一个发布事件、一个回滚场景和一个版本管理问题。本文通过LLMOps规范、提示词与模型可追溯性、受控发布以及基于证据的回滚准备,阐述了在生产环境中应如何处理Qwen 3.6。
how-to-make-sql-modeno_engine_substitution-permanent-in-mysql-my-cnf

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

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

全面评估指南:精通LLM性能评估
本指南详细介绍了评估工具(Evaluation Harness),这是一个在企业级LLMOps流程中严格评估大型语言模型(LLM)能力的关键框架。您将学习其设置方法、最佳实践以及高级技巧,以确保模型基准测试与优化的可靠性。