How to Install PHP 8.2 for Nginx on Fedora 39

To install PHP 8.2 for Nginx on Fedora 39, follow these steps:

Step 1 : Update your system to ensure you have the latest packages and dependencies.

Step 2 : Install the Remi repository that provides the PHP packages.

Step 3 : Check PHP Modules

Step 4 : Enable PHP Remi Repository

Step 5 : Install PHP 8.2 and essential components.

Step 6 : Install frequently used PHP extensions.

- mysqlnd: Enhances MySQL database support.

- curl: Enables URL-related functions.

- gd: Facilitates image creation and manipulation.

- mcrypt: Handles encryption and decryption tasks.

- json: Supports JSON (JavaScript Object Notation) data format.

- pear: Manages PHP extensions and applications.

- common: Shared files necessary for PHP.

- xml: Provides Extensible Markup Language support.

- zip: Allows compression and decompression of files.

- devel: Includes development files for PHP.

- xsl: Supports Extensible Stylesheet Language transformations.

- soap: Facilitates Simple Object Access Protocol functionality.

- bcmath: Enables arbitrary precision mathematics.

- mbstring: Provides multibyte string manipulation functions.

- gettext: Supports internationalization and localization.

- imagick: Integrates the ImageMagick PHP extension.

Step 7 : Update php-fpm Configuration

Edit the PHP-FPM configuration file to set the user and group.

Locate and replace "user" and "group" values with "nginx."

Step 8 : Restart the PHP-FPM service for changes to take effect.

Step 9 : Configure Nginx to Use PHP

Edit your Nginx configuration file for your domain.

Add the following configuration

Step 10 : Check the syntax of your Nginx configuration.

Step 11 : Restart the Nginx web server to apply the changes.

Step 12 : Create a file named info.php in your web root directory with the following content:

Step 13 : Visit your domain to see the PHP info page and ensure that PHP is working correctly with Nginx.

Congratulations! You have successfully installed PHP 8.2 on Fedora 39, configured Nginx to use PHP.