FedoraRHEL Based

How To Install PHP on Fedora 38

Install PHP on Fedora 38

In this tutorial, we will show you how to install PHP on Fedora 38. With the release of PHP 8, developers can now enjoy the latest features and improvements that come with it. From faster performance to better JIT compilation, PHP 8 offers a range of benefits that can help streamline coding processes and increase productivity. Overall, installing PHP 8 on Fedora 38 is a straightforward process. As long as you have the necessary prerequisites in place and follow the installation steps correctly, you should be up and running in no time.

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 programming language on a Fedora 38.


  • A server running one of the following operating systems: Fedora 38.
  • 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).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for PHP.
  • 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 38

Step 1. Before we can install PHP on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install PHP without any issues:

sudo dnf upgrade --refresh

Step 2. Installing PHP on Fedora 38.

PHP 8 requires several dependencies, which can be installed using the following command:

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

With the repository installed, we can now proceed to download the latest version of PHP 8 by running the following command:

sudo dnf module reset php
sudo dnf module enable php:remi-8.0
sudo dnf install php php-common php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json

After the installation is complete, we need to verify that the PHP version is correctly installed. To do this, we can run the following command:

php -v

Step 3. Configuring PHP 8.

Now that we have PHP 8 installed on our Fedora 38 system, it’s time to start configuring it to better suit our needs. In this section, we’ll cover some basic configurations that can help improve the performance and security of PHP 8.

Updating php.ini √

One of the first things to do when configuring PHP 8 is to edit the php.ini file. This file contains many important settings that control how PHP behaves. We can add or modify settings in this file to better fit our specific use case.

To edit the php.ini file, simply open it in your preferred text editor. Some common settings to consider modifying include:

  • max_execution_time: This sets the amount of time PHP is allowed to execute a script. This can help prevent long-running scripts from hogging system resources and causing problems for other users.
  • memory_limit: This controls the maximum amount of memory a PHP script is allowed to use. Setting this too low can cause problems, so it’s important to monitor your system’s memory usage to ensure you’re not running out of memory.
  • error_reporting: This controls which types of errors and warnings PHP will report. Setting this to the appropriate level can help you catch errors and debug your code more easily.

Enabling OPCache √

OPCache is a bytecode caching engine that can significantly improve the performance of PHP applications. It works by caching compiled PHP bytecode in shared memory, which means subsequent requests for the same code can be served much faster.

To enable OPCache, simply add the following line to your php.ini file:


You can also adjust its settings, such as the amount of memory it’s allowed to use, by adding additional lines to the php.ini file.

Securing PHP √

Finally, it’s important to ensure that PHP is configured securely to prevent potential attacks. Some tips for securing PHP include:

  • Disable dangerous functions: Some PHP functions are inherently insecure and can be used to run arbitrary code on your server. You can disable these functions by adding them to the disable_functions list in your php.ini file.
  • Implement input validation: Input validation is a critical part of ensuring your PHP code is secure. Always ensure that any user input is properly sanitized and validated before use to prevent attacks such as SQL injection.
  • Keep PHP up to date: Finally, it’s important to keep PHP up to date with the latest security patches to protect against known vulnerabilities.

By following these basic configuration steps and best practices, you can help ensure that PHP 8 is running efficiently and securely on your Fedora 38 system.

Congratulations! You have successfully installed PHP. Thanks for using this tutorial for installing the PHP programming language on your Fedora 38 system. For additional help 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