CN

How to Install PHP 8.3 on Linux: A Comprehensive Guide for Major Distributions

Learn how to install PHP 8.3 on various Linux distributions including Ubuntu, Debian, CentOS, and Fedora. Step-by-step instructions and troubleshooting tips included.

How to Install PHP 8.3 on Linux: A Comprehensive Guide for Major Distributions

Ready to harness the power of PHP 8.3 on your Linux system? This guide will walk you through the installation process on major Linux distributions, ensuring you're up and running with the latest PHP version in no time.

Why Upgrade to PHP 8.3?

PHP 8.3 brings a host of new features and improvements, including:

  • Enhanced performance
  • New string functions
  • Improved type system
  • Readonly class support

Upgrading ensures you're using the most secure and efficient version of PHP for your projects.

Installing PHP 8.3 on Ubuntu and Debian

1. Update Package Lists

First, update your package lists:

Terminal
sudo apt update

2. Add PPA Repository

Add the PHP repository:

Terminal
sudo add-apt-repository ppa:ondrej/php
sudo apt update

3. Install PHP 8.3

Install PHP 8.3 and common extensions:

Terminal
sudo apt install php8.3 php8.3-cli php8.3-common php8.3-curl php8.3-mbstring php8.3-mysql php8.3-xml

Installing PHP 8.3 on CentOS and RHEL

1. Enable EPEL and Remi Repository

First, enable the EPEL and Remi repositories:

Terminal
sudo dnf install epel-release
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

2. Enable PHP 8.3 Module

Enable the PHP 8.3 module:

Terminal
sudo dnf module enable php:remi-8.3

3. Install PHP 8.3

Install PHP 8.3 and common extensions:

Terminal
sudo dnf install php php-cli php-common php-curl php-mbstring php-mysql php-xml

Installing PHP 8.3 on Fedora

1. Enable Remi Repository

First, enable the Remi repository:

Terminal
sudo dnf install https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm

2. Enable PHP 8.3 Module

Enable the PHP 8.3 module:

Terminal
sudo dnf module reset php
sudo dnf module enable php:remi-8.3

3. Install PHP 8.3

Install PHP 8.3 and common extensions:

Terminal
sudo dnf install php php-cli php-common php-curl php-mbstring php-mysql php-xml

Verifying the Installation

To confirm that PHP 8.3 is installed correctly, run:

Terminal
php -v

You should see output indicating PHP 8.3.x is installed.

Troubleshooting

If you encounter any issues during installation, try the following:

  1. Ensure your system is up to date:
  • For Ubuntu/Debian: sudo apt update && sudo apt upgrade
  • For CentOS/RHEL/Fedora: sudo dnf update
  1. Check for conflicting PHP versions and remove them if necessary.
  2. Verify that all required repositories are properly added and enabled.
  3. Check system logs for any error messages: sudo journalctl -xe

Conclusion

Congratulations! You've successfully installed PHP 8.3 on your Linux system. Enjoy the new features and improved performance in your web development projects.

For more information on PHP 8.3 features, check out the official PHP documentation.

Happy coding!

Want to read more articles like that?

Sign up to get notified when I publish more.

No spam. One click unsubscribe.

Read More on Fado Code Camp