To install PHP 8.2 for Nginx on CentOS Stream 9, follow the detailed steps below.
Step 1 : Begin by updating your system to ensure you have the latest packages and dependencies.
Step 2 : Install the Remi repository, which provides up-to-date PHP packages.
Step 3 : Check the available PHP modules to ensure compatibility with your system.
Step 4 : Enable the PHP Remi repository for PHP 8.2.
Step 5 : Install the PHP 8.2 core package.
Step 6 : Install essential PHP extensions commonly used in web applications.
Explanation:
- php-fpm
: PHP FastCGI Process Manager.
- php-cli
: Command-line interface for PHP.
- php-mysqlnd
: MySQL Native Driver.
- php-curl
: cURL support for PHP.
- php-gd
: GD Graphics Library for PHP.
- php-mcrypt
: Mcrypt library for PHP (deprecated in PHP 7.2 and higher).
- php-json
: JSON support for PHP.
- php-pear
: Package and dependency management framework for PHP.
- php-common
: Common files for PHP.
- php-xml
: XML support for PHP.
- php-zip
: ZIP support for PHP.
- php-devel
: PHP development package for compiling additional extensions.
- php-xsl
: XSL support for PHP.
- php-soap
: SOAP support for PHP.
- php-bcmath
: Bcmath support for PHP.
- php-mbstring
: Mbstring support for PHP.
- php-gettext
: Gettext support for PHP.
- php-imagick
: Imagick support for PHP.
Step 7 : Edit the www.conf file to configure PHP-FPM to use the Nginx user and group.
Step 8 : Enable PHP-FPM to start on boot and start the service.
Step 9 : Confirm the installed PHP version.
Step 10 : Set up Nginx configuration to process PHP files for your domain.
Step 11 : Test Nginx Configuration
Step 12 : Restart Nginx to apply the new configuration.
Step 13 : Create a simple PHP file for testing purposes.
Step 14 : Visit your domain to view the PHP info
Congratulations! You have successfully installed PHP 8.2 for Nginx on CentOS Stream 9.