FedoraRHEL Based

How To Install PHP on Fedora 39

Install PHP on Fedora 39

In this tutorial, we will show you how to install PHP on Fedora 39. PHP 8.2 stands as a testament to PHP’s commitment to innovation, offering a range of improvements and new features. Enhanced type system, JIT compiler advancements, and better error handling make it a compelling upgrade. Developers and system administrators find in PHP 8.2 a robust platform with improved performance and security.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the PHP scripting language on a Fedora 39.


Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • You’ll need an active internet connection to download PHP and its dependencies.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install PHP on Fedora 39

Step 1. Before you dive into the installation, ensure that your Fedora 39 system is up to date. Start by refreshing your system repositories:

sudo dnf clean all
sudo dnf update

Step 2. Enabling the Remi Repository.

Begin by installing the Remi repository RPM package. Execute the following command to enable the PHP 8.2 repository:

sudo dnf install https://rpms.remirepo.net/fedora/remi-release-39.rpm

Ensure the repository is enabled by default:

sudo dnf module reset php
sudo dnf module enable php:remi-8.2

Confirm the repository configuration using:

sudo dnf list php\*

This should display the available PHP packages, affirming the successful repository addition.

Step 3. Installing PHP on Fedora 39.

Now install PHP 8.2 and the necessary modules:

sudo dnf install php

For additional modules, use the following format:

sudo dnf install php-module_name

After installation and configuration, it’s vital to ensure that PHP 8.2 is functioning as expected. First, verify the installed PHP version:

php -v

Now, create a simple PHP script to confirm that PHP is correctly configured. For example, create a file named ‘test.php‘ in your web server’s document root directory with the following content:


Access the script through your web browser by navigating to ‘http://your_server_ip/test.php‘. You should see a comprehensive PHP information page.

Step 4. Configuration and Optimization.

To ensure PHP 8.2 performs optimally on your Fedora 39 system, you might need to make some configuration adjustments. The primary configuration file for PHP is php.ini. You can locate it at /etc/php.ini.

You can tweak various settings within php.ini to match your specific requirements. For instance, you can increase the maximum upload file size, set time zones, and fine-tune memory limits. Here’s an example of increasing the maximum upload file size:

sudo nano /etc/php.ini

Find the upload_max_filesize parameter and modify it as per your requirements:

upload_max_filesize = 32M

Remember to restart the Apache web server for changes to take effect:

sudo systemctl restart httpd

Step 5. Troubleshooting and Common Issues.

Installation and configuration can sometimes present challenges. Here are some common issues and how to resolve them:

  • PHP Not Working

If PHP isn’t functioning as expected, review the installation steps and ensure that the Remi repository is correctly configured. Restart the web server if necessary.

  • Extensions Issues

If you encounter problems with PHP extensions, double-check that you’ve installed them correctly and that they’re enabled in ‘php.ini‘.

  • Permissions Problems

Ensure that your web server has the necessary permissions to read PHP files and execute scripts.

  • Error Logs

Check PHP error logs for detailed information on any problems:

tail -f /var/log/php-fpm/error.log

Congratulations! You have successfully installed PHP 8.2. Thanks for using this tutorial for installing the PHP popular general-purpose scripting language on your Fedora 39 system. For additional Apache or useful information, we recommend you check the official PHP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
Back to top button