To install PHP 8.2 for Apache on CentOS 7, follow the steps below.
Step 1 : Ensure your system is up to date by running:
Step 2 : Import the Remi repository for PHP:
Step 3 : Enable the PHP 8.2 repository:
Step 4 : Install PHP Core
Step 5 : Install PHP Extensions
These are commonly used PHP extensions:
- php-cli: Command line interface for PHP.
- php-mysqlnd: MySQL Native Driver - A MySQL database client for PHP.
- php-curl: Client URL Library for PHP - Allows you to connect and communicate to different types of servers with different protocols.
- php-gd: GD Graphics Library - Allows you to create and manipulate images using various functions.
- php-mcrypt: Encryption functions - Provides encryption and decryption functions.
- php-json: JSON extension - Allows you to work with JSON data.
- php-pear: PEAR framework - PHP Extension and Application Repository, used for managing and distributing PHP packages.
- php-common: Common files for PHP.
- php-xml: XML extension - Allows you to work with XML data.
- php-zip: ZIP extension - Allows you to work with ZIP archives.
- php-devel: Development files for PHP.
- php-xsl: XSL extension - Allows you to work with XSL transformations.
- php-soap: SOAP extension - Allows you to work with SOAP web services.
- php-bcmath: BCMath Arbitrary Precision Mathematics extension - Provides arbitrary precision mathematics functions.
- php-mbstring: Multibyte String extension - Provides multibyte string functions.
- php-gettext: Gettext extension - Allows you to internationalize your PHP applications.
- php-imagick: ImageMagick extension - Allows you to create, edit, and compose bitmap images.
Step 6 : Check the installed PHP version:
Step 7 : Restart Apache to apply changes:
Step 8 : Create a PHP info file:
Add the following content to the file:
Step 9 : Now, visit your domain followed by "/info.php" in a web browser to view PHP information.
Congratulations! You have successfully installed PHP 8.2 for Apache on CentOS 7.