How to Install PHP 8.1 on Fedora 40

To install PHP 8.1 on Fedora 40, we'll go through several steps.

Step 1 : Ensure your system is up to date by running:

Step 2 : Add the Remi repository to your system:

Step 3 : Check available PHP modules:

Step 4 : Enable the PHP Remi repository:

Step 5 : Install PHP core and necessary packages:

Step 6 : Install commonly used PHP extensions like mysqlnd, curl, gd, mcrypt, json, pear....

Explanation:

  • mysqlnd: MySQL native driver for PHP
  • curl: cURL extension for PHP, useful for making HTTP requests
  • gd: GD extension for PHP, used for image processing
  • mcrypt: Mcrypt extension for PHP, for encryption functions
  • json: JSON extension for PHP, for working with JSON data
  • pear: PEAR package manager for PHP
  • common: Common files for PHP
  • xml: XML extension for PHP
  • zip: Zip extension for PHP, for working with zip files
  • devel: Development files for PHP
  • xsl: XSL extension for PHP, for working with XSLT transformations
  • soap: SOAP extension for PHP, for web services
  • bcmath: BCMath extension for PHP, for arbitrary precision mathematics
  • mbstring: Mbstring extension for PHP, for multibyte string functions
  • gettext: Gettext extension for PHP, for internationalization
  • imagick: Imagick extension for PHP, for image manipulation using ImageMagick

Step 7 : Verify the PHP installation and version:

Congratulations! You have successfully installed PHP 8.1 on Fedora 40.