
Installing PHP on Fedora 44 is straightforward, but doing it the right way matters if you want a stable web stack, a clean upgrade path, and fewer surprises later. In this guide, I will show you how to Install PHP on Fedora 44 with practical commands, clear explanations, and the reasoning behind each step so you understand not just what to type, but why it matters.
If you are building a local dev box, a production-like test server, or a fresh Linux server tutorial setup, Fedora gives you two solid paths: the Fedora package stream for easy system integration, and Remi for newer PHP builds when you need a more recent release. I will cover both approaches so you can choose the one that fits your app, your risk level, and your maintenance style.
Prerequisites
Before you start, make sure you have the basics in place.
- Fedora 44 installed and updated.
- A user with sudo access or root access.
- An internet connection for package downloads.
- A text editor such as
nano,vim, orvi. - A web server if you plan to run PHP in the browser, such as Apache or Nginx.
- A backup of any existing PHP or web server configuration.
These items matter because PHP rarely runs alone. It usually sits between your web server, your database, and your application code, so a clean starting point helps you avoid dependency conflicts and broken services.
Step 1: Update Your System
Keeping the system current is the safest first move in any Install PHP on Fedora 44 setup. It refreshes package metadata and reduces the chance of dependency conflicts during installation.
Update package metadata
sudo dnf upgrade --refresh
This command updates your installed packages and reloads repository metadata. The why is simple: PHP packages often depend on shared libraries, and Fedora updates those libraries over time, so a fresh system makes installation smoother.
Confirm the system is ready
cat /etc/fedora-release
Expected output:
Fedora release 44 (Forty Four)
This check confirms you are on the correct release before you install packages made for Fedora 44. That matters because repository streams and package versions can differ between Fedora releases.
Step 2: Check Available PHP Streams
Fedora often ships PHP through modular package streams. That means you should check what is available before installing anything.
List PHP modules
sudo dnf module list php
This shows the available PHP streams and tells you which version Fedora offers by default. The why is important here: if you do not inspect module streams first, you can end up mixing packages from different sources, which can break updates later.
Check existing PHP packages
rpm -qa | grep '^php'
If PHP is already installed, this shows what is on the system. The why is to catch partial installs or version conflicts before you add more packages.
Step 3: Install PHP from Fedora Repos
If you want a stable and clean installation, Fedora packages are the best starting point. This is usually the right option for most developers and sysadmins who want a reliable How To Install PHP on Fedora 44 workflow.
Install the core PHP package
sudo dnf install -y php-cli php-common php-fpm
This installs the command-line PHP interpreter, shared PHP files, and PHP-FPM. The why is that php-cli lets you run scripts from the terminal, while php-fpm handles web requests efficiently for Nginx and also works well with Apache setups.
Install common extensions
sudo dnf install -y php-mysqlnd php-xml php-mbstring php-gd php-curl php-zip php-opcache
These extensions cover common real-world needs. The why is that many apps, including CMS platforms and frameworks, need database access, XML parsing, string handling, image support, HTTP requests, archive support, and opcode caching.
Example output to expect
Complete!
Installed:
php-cli-8.x.x
php-common-8.x.x
php-fpm-8.x.x
Version numbers may differ, but a clean install should end with Complete!. That confirms DNF resolved dependencies successfully.
Step 4: Verify PHP Installation
After install, confirm that PHP works before you configure the web server. This saves time and makes troubleshooting easier.
Check PHP version
php -v
Expected output:
PHP 8.x.x (cli) (built: ...)
Copyright (c) The PHP Group
Zend Engine v4.x.x, Copyright (c) Zend Technologies
This tells you the CLI binary is installed and responding. The why is that you want to verify the runtime before building anything on top of it.
List loaded modules
php -m
This shows which extensions PHP can load right now. The why is to confirm that modules such as mbstring, curl, or xml are available before you deploy an application that requires them.
Step 5: Start PHP-FPM
For most modern stacks, PHP-FPM is the better way to run PHP. It is more flexible and fits cleaner with Nginx and Apache proxy setups.
Enable the service at boot
sudo systemctl enable --now php-fpm
This starts PHP-FPM now and enables it for future boots. The why is that your web applications need the PHP worker service running continuously if they serve browser requests.
Check service status
systemctl status php-fpm
Expected output:
active (running)
That status means PHP-FPM is healthy. If it is not active, you should fix that before moving on to web server configuration.
Step 6: Configure PHP on Fedora 44 with Apache
If you use Apache, you can connect it to PHP-FPM instead of relying on older embedded PHP setups. This is a cleaner design for most systems.
Install Apache
sudo dnf install -y httpd
This installs the Apache web server. The why is that PHP alone does not serve web pages, so you need a web server to receive requests and pass PHP files to the PHP runtime.
Start Apache
sudo systemctl enable --now httpd
This starts Apache now and on boot. The why is to keep your site available after reboots.
Create a test PHP file
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
This creates a simple PHP test page. The why is that phpinfo() gives a fast way to confirm PHP execution through the web server path, not just the CLI.
Open the test page
curl http://localhost/info.php
Expected output is HTML that includes PHP configuration details. This proves the browser path works, not just the terminal path.
Step 7: Configure PHP on Fedora 44 with Nginx
If you prefer Nginx, PHP-FPM is the standard match. This setup is common in production-style environments and is often the cleaner choice for modern stacks.
Install Nginx
sudo dnf install -y nginx
This installs Nginx. The why is that Nginx handles web requests while PHP-FPM executes PHP code behind the scenes.
Enable and start Nginx
sudo systemctl enable --now nginx
This starts the service immediately and at boot.
Configure a PHP location block
sudo nano /etc/nginx/conf.d/php-test.conf
Add this content:
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
This tells Nginx how to pass PHP files to PHP-FPM. The why is that Nginx does not execute PHP itself, so it needs a FastCGI handoff to the PHP worker process.
Test the config
sudo nginx -t
Expected output:
syntax is ok
test is successful
This check matters because one bad config line can stop Nginx from loading.
Step 8: Install the Latest PHP with Remi
If you need a newer PHP release than Fedora provides, Remi is the common third-party choice. This is useful when your app requires a newer feature set or a more recent security branch.
Add the Remi repository
sudo dnf install -y https://rpms.remirepo.net/fedora/remi-release-44.rpm
This adds the Remi repository for Fedora 44. The why is that Remi publishes current PHP branches and lets you install versions that may not yet be in Fedora’s default stream.
Reset the default PHP module
sudo dnf module reset php -y
This clears the current PHP module state. The why is to prevent the Fedora stream from conflicting with the Remi stream.
Enable the Remi PHP stream
sudo dnf module enable php:remi-8.4 -y
This switches PHP selection to the Remi 8.4 stream. The why is that modular PHP packages must be enabled before DNF can install that version cleanly.
Install PHP from Remi
sudo dnf install -y php php-cli php-fpm php-mysqlnd php-xml php-mbstring php-gd php-curl php-zip php-opcache
This installs the actual runtime and common extensions. The why is the same as the Fedora method, but now you get the newer Remi-built packages for the selected stream.
Verify the installed version
php -v
Expected output:
PHP 8.4.x
The exact patch version may vary, but the important point is that the version matches the stream you enabled.
Step 9: Fine-Tune Permissions and SELinux
Permissions problems are one of the most common reasons PHP setups fail on Fedora. Fedora uses strong security defaults, and that is a good thing.
Fix file ownership for web files
sudo chown -R nginx:nginx /usr/share/nginx/html
This sets the correct owner for Nginx content. The why is that the web server needs permission to read files, and the right ownership avoids access errors.
Restore SELinux context
sudo restorecon -Rv /usr/share/nginx/html
This repairs SELinux labels on the directory. The why is that SELinux can block access even when standard file permissions look correct.
Troubleshooting
Here are the most common problems you may hit when you configure PHP on Fedora 44.
1. PHP shows in terminal, but not in browser
This usually means PHP-FPM is not connected to the web server. Check your Nginx or Apache config and confirm the socket path matches /run/php-fpm/www.sock.
2. php-fpm will not start
journalctl -u php-fpm -xe
This shows the service logs. The why is that the log often tells you whether the issue is a bad config, a missing socket, or a permission problem.
3. Nginx returns 502 Bad Gateway
This often means PHP-FPM is down or the socket path is wrong. Check both services.
systemctl status php-fpm
systemctl status nginx
4. SELinux blocks PHP files
If the browser cannot read files even when permissions look fine, SELinux may be the cause. Use restorecon, then retest.
5. Wrong PHP version installed
If php -v shows the wrong version, check your active module stream.
sudo dnf module list php
The why is that module conflicts can override what you expect from the repository.