To install PHP 8.4 on CentOS Stream 10 for use with Nginx, follow the steps outlined below.
Step 1 : Update your system packages to ensure you have the latest versions available:
Step 2 : The Remi repository provides access to the latest PHP versions. Install it using:
Step 3 : List all available PHP modules to confirm the PHP 8.4 package is available:
Step 4 : Enable the repository for PHP 8.4:
Step 5 : Install the PHP core package:
Step 6 : Install frequently used PHP extensions:
- fpm: Handles PHP requests via FastCGI for Nginx.
- cli: Command-line interface for running PHP scripts.
- mysqlnd: Native driver for MySQL database connections.
- curl: For handling HTTP requests.
- gd: Image processing library.
- mcrypt: Encryption support.
- json: JSON data handling.
- pear: PHP package management system.
- common: Common PHP files.
- xml: XML processing.
- zip: ZIP file support.
- devel: Development files for compiling PHP extensions.
- xsl: XSLT processing.
- soap: SOAP protocol support.
- bcmath: Mathematical operations.
- mbstring: Multibyte string processing.
- gettext: Localization support.
- imagick: Image manipulation using ImageMagick.
Step 7 : Edit the PHP-FPM configuration file:
Replace user = apache
and group = apache
with:
Step 8 : Enable and start the PHP-FPM service:
Step 9 : Check the PHP version to confirm the installation:
Step 10 : To configure Nginx to use PHP, create or edit the domain configuration file (e.g., /etc/nginx/conf.d/example.com.conf
):
Step 11 : Verify the Nginx configuration for syntax errors:
Step 12 : Restart the Nginx service to apply the changes:
Step 13 : Create a PHP info file to test the setup:
Step 14 : Access the Info Page
Visit http://example.com/info.php
in your browser. You should see the PHP info page displaying PHP 8.4 details.
Congratulations! You have successfully installed PHP 8.4 for Nginx on CentOS Stream 10.