{"id":599,"date":"2025-05-24T03:22:04","date_gmt":"2025-05-24T00:22:04","guid":{"rendered":"http:\/\/localhost\/wordpress\/index.php\/2014\/11\/04\/30-mostly-used-linux-commands-for-newbies-with-examples\/"},"modified":"2025-05-24T03:22:12","modified_gmt":"2025-05-24T00:22:12","slug":"how-to-install-php-on-fedora-linux-system","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/how-to-install-php-on-fedora-linux-system\/","title":{"rendered":"Install PHP 8.1 on Fedora Linux 42\/41\/40\/39"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-1024x683.webp\" alt=\"\" class=\"wp-image-160172\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-1024x683.webp 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-300x200.webp 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-768x512.webp 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-630x420.webp 630w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-696x464.webp 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora-1068x712.webp 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2024\/07\/php-8.1-install-fedora.webp 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Looking for a simple way to install PHP 8.1 on Fedora? You can easily get the PHP 8.1 packages from the Remi repository. PHP is a versatile scripting language widely used to build dynamic websites and robust web applications. It was first created by Rasmus Lerdorf back in 1994.<\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll walk you through the steps to install and run PHP 8.1 on a Fedora Linux system. Whether you\u2019re using a cloud server, an on-premises Fedora installation, or your Fedora workstation, this guide will help you get set up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><em>New Features in PHP 8.1<\/em><\/h3>\n\n\n\n<p>Below are some new features in PHP 8.1 release. More details about each feature is available in the official PHP website.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Readonly properties<\/strong>&nbsp;\u2013 Class properties can be marked as readonly hence can only be written once<\/li>\n\n\n\n<li>Support for DNS-over-HTTPS (DoH)<\/li>\n\n\n\n<li><strong>AVIF Image Format support&nbsp;<\/strong>\u2013 The PHP 8.1\u2019s image processing and GD extension adds support for AVIF images.<\/li>\n\n\n\n<li><strong>Never Return Type<\/strong>&nbsp;\u2013 A new return type hint called never is added in PHP 8.1<\/li>\n\n\n\n<li><strong>Added support for Fibers<\/strong>&nbsp;\u2013 The low level mechanism to manage parallelism<\/li>\n\n\n\n<li>PHP 8.1 adds array_is_list as a built-in function<\/li>\n\n\n\n<li><strong>File Uploads with CURLStringFile<\/strong>&nbsp;\u2013 In PHP 8.1, PHP Curl extension now supports HTTP(S) requests with file uploads<\/li>\n\n\n\n<li><strong>Enums<\/strong>&nbsp;\u2013 They are now added in PHP 8.1<\/li>\n\n\n\n<li>New fdatasync() and fsync() Functions<\/li>\n\n\n\n<li>New Sodium XChaCha20 functions<\/li>\n\n\n\n<li>Addition of pure intersection types feature<\/li>\n\n\n\n<li>Explicit Octal Numeral Notation<\/li>\n\n\n\n<li>Define final Class Constants<\/li>\n\n\n\n<li>MurmurHash3 hash algorithm support<\/li>\n\n\n\n<li>Intersection Types<\/li>\n\n\n\n<li>xxHash hash algorithms support<\/li>\n\n\n\n<li>For detailed information read through the official&nbsp;<a href=\"https:\/\/php.watch\/versions\/8.1\" target=\"_blank\" rel=\"noreferrer noopener\">PHP 8.1 notes<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Install PHP 8.1 on Fedora<\/h2>\n\n\n\n<p>For normal PHP requirements, you can go with the latest version available on the default Fedora RPM repositories. For any version of PHP not in the default repos, you&#8217;ll be required to add third party repository such as REMI or build from source.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Enable Remi repository<\/h3>\n\n\n\n<p>Perform an update on your Fedora system<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y update<\/code><\/pre>\n\n\n\n<p>Then proceed to enable Remi repository on Fedora.<\/p>\n\n\n\n<p><strong>Fedora 42:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y install http:\/\/rpms.remirepo.net\/fedora\/remi-release-42.rpm<\/code><\/pre>\n\n\n\n<p><strong>Fedora 41:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y install http:\/\/rpms.remirepo.net\/fedora\/remi-release-41.rpm<\/code><\/pre>\n\n\n\n<p><strong>Fedora 40:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y install http:\/\/rpms.remirepo.net\/fedora\/remi-release-40.rpm<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install PHP 8.1 on Fedora<\/h3>\n\n\n\n<p>After addition of REMI repository, disable default AppStream PHP module.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y module reset php<\/code><\/pre>\n\n\n\n<p>Enable <code>php:remi-8.1<\/code> module<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf module enable php:remi-8.1\nsudo dnf  install php<\/code><\/pre>\n\n\n\n<p>In older fedora versions you may need:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf -y install dnf-plugins-core\nsudo dnf config-manager --set-enabled remi\nsudo dnf -y module install php:remi-8.1<\/code><\/pre>\n\n\n\n<p>Check installed version of PHP on your Fedora Linux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">php --version<\/mark>\nPHP 8.1.32 (cli) (built: Mar 11 2025 22:09:20) (NTS gcc x86_64)\nCopyright (c) The PHP Group\nZend Engine v4.1.32, Copyright (c) Zend Technologies\n    with Zend OPcache v8.1.32, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Installing multiple versions of PHP<\/h4>\n\n\n\n<p>If you&#8217;re interested in having multiple versions of PHP on your Fedora system, then install from&nbsp;<strong><em>php81<\/em><\/strong>&nbsp;collection which is available in the remi-safe repository and can be installed with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php81<\/code><\/pre>\n\n\n\n<p>Additional PHP extensions can then be installed using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php81-php-xxx<\/code><\/pre>\n\n\n\n<p>To check the version of PHP 8.1 installed using this method, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php81 --version<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: <meta charset=\"utf-8\">Install PHP 8.1 extensions<\/h3>\n\n\n\n<p>Install PHP extensions using the name format&nbsp;<strong>php-&lt;extension&gt;.<\/strong>&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php-<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">&lt;extension&gt;<\/mark><\/code><\/pre>\n\n\n\n<p>Here is an example to install mostly used extensions of PHP:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php-{cli,fpm,mysqlnd,zip,devel,gd,mcrypt,mbstring,curl,xml,pear,bcmath,json,opcache}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Use PHP-FPM on Nginx \/ Apache<\/h3>\n\n\n\n<p>The default PHP configuration file&nbsp;is<strong><em> \/etc\/php.ini<\/em><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cat \/etc\/php.ini<\/code><\/pre>\n\n\n\n<p>For Nginx web server, use PHP-FPM (FastCGI Process Manager) configuration file to set CGI settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/php-fpm.d\/www.conf<\/code><\/pre>\n\n\n\n<p>Once your PHP and PHP-FPM settings are modified, nginx and httpd web server services can be restarted.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><em># Nginx<\/em>\n<\/mark>sudo systemctl enable --now php-fpm<strong><em>\n<\/em><\/strong>sudo systemctl restart nginx\n\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><em># Apache<\/em>\n<\/mark>sudo systemctl enable --now php-fpm<strong><em>\n<\/em><\/strong>sudo systemctl restart httpd<\/code><\/pre>\n\n\n\n<p>You should now have PHP 8.1 installed on Fedora Linux system. Enjoy PHP Development and have an amazing Code time.<\/p>\n\n\n\n<p>Installation of PHP 8.1 on other systems:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install PHP 8.1 on Rocky Linux 8|AlmaLinux 8|CentOS 8<\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-install-php-centos-rhel-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Install PHP 8.1 on CentOS 7|RHEL 7<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-install-php-on-debian-linux-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Install PHP 8.1 on Debian<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-install-php-on-ubuntu-linux-system\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Install PHP 8.1 on Ubuntu<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Looking for a simple way to install PHP 8.1 on Fedora? You can easily get the PHP 8.1 packages from the Remi repository. PHP is a versatile scripting language widely used to build dynamic websites and robust web applications. It was first created by Rasmus Lerdorf back in 1994. In this tutorial, we&#8217;ll walk you &#8230; <a title=\"Install PHP 8.1 on Fedora Linux 42\/41\/40\/39\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/how-to-install-php-on-fedora-linux-system\/\" aria-label=\"Read more about Install PHP 8.1 on Fedora Linux 42\/41\/40\/39\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":160172,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,690,29,299],"tags":[36384,191,36310,36324],"class_list":["post-599","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-tutorials","category-dev","category-fedora","category-how-to","tag-install-php-8-1-on-fedora","tag-php","tag-php-8-1","tag-php-8-1-on-fedora"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=599"}],"version-history":[{"count":4,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/599\/revisions"}],"predecessor-version":[{"id":160173,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/599\/revisions\/160173"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/160172"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}