How To Install PHP 8.0 on Fedora 36/35/34/33/32

Posted on 112 views

To Install PHP on Fedora 36/35/34/33/32, you need to add Remi repository to your system. PHP 8.0 is available for installation on any Fedora Linux system. PHP is a popular general-purpose scripting language that is especially suited to web development. It was originally created by Rasmus Lerdorf in 1994.

Install PHP 8.0 on Fedora 36/35/34/33/32

It is recommended to install the latest version available on the default Fedora RPM repositories. The version you’ll get varies from one Linux distribution to another. If you need a version of PHP not available on the upstream repositories, consider using third party repositories such as Remi.

To ensure this article works on any Fedora system we’ll use REMI repository method to install PHP8.0 on Fedora 36/35/34/33/32.

Install PHP 8.0 on Fedora using Remi repository

For any other version of PHP not in default system repositories, add the Remi repository as shown in the next sections.

Update your Fedora system.

sudo dnf -y update

Fedora 36:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-36.rpm

Fedora 35:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-35.rpm

Fedora 34:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm

Fedora 33:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm

Fedora 32:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm

Once the repository is installed, enable the one with the version of PHP you need. See below example:

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled remi
sudo dnf module reset php -y
sudo dnf module -y install php:remi-8.0

Install PHP extensions using the name format php-. Example:

sudo dnf -y install php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

You should now have PHP installed on Fedora:

$ php -v
PHP 8.0.19 (cli) (built: May 10 2022 08:07:35) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies

The default PHP configuration file is etc/php.ini. For Nginx web server, use PHP-FPM (FastCGI Process Manager) configuration file to set CGI settings /etc/php-fpm.d/www.conf

When PHP settings are modified, you may need to restart your Web server.

# Nginx
sudo systemctl enable --now php-fpm
sudo systemctl restart nginx

# Apache
sudo systemctl enable --now php-fpm
sudo systemctl restart httpd

PHP 8.0 has been installed successfully on Fedora 36/35/34/33/32/31 Linux machine. Enjoy PHP Development and have a great time.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.