How to Upgrade PHP 7.4 to 8.2 on RHEL 7

How to Upgrade PHP 7.4 to 8.2 on RHEL 7


PHP (Hypertext Preprocessor) is a free and open-source server-side scripting language. Which is used to generate dynamic web page. PHP contain HTML, Text and script blocks. When user request for a PHP page through web browser than PHP script execute on web server and display the requested result in browser.

Upgrade PHP 7.4 to 8.2

Follow the steps below to upgrade PHP 7.4 to PHP 8.2 on a RHEL 7 system:

1. Upgrade Security and System Packages:

Before installing any new software, it is recommended to update your system packages. You can do this by running the following command:

 

#sudo yum --security update

#sudo yum update

 

 

2. Check Current PHP Version:

Next, check the current version of PHP by running the following command:

#php -v

PHP 7.4.33 (cli) (built: Dec 12, 2023, 14:45:16) (NTS)

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

 

Example Output:

PHP 7.4.33 (cli) (built: Dec 12, 2023, 14:45:16) (NTS)

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

 

3. Verify Enabled PHP Repositories:

Check which PHP Remi repository is enabled on your system by running the following command:

# yum repolist enabled

 

Example output:

remi-php74                                                  Remi's PHP 7.4 RPM repository for Enterprise Linux 7 - x86_64                                466

Confirm that the enabled PHP version is 7.4.

 

4. Disable Old Version and Enable 8.2:

Disable the old version (7.4) and enable version 8.2 by running the following commands:

 

# sudo yum-config-manager --disable remi-php74

# sudo yum-config-manager --enable remi-php82

 

 

5. Verify PHP 8.2 is Enabled:

Check that version 8.2 is enabled by running the following command:

# yum repolist enabled

 

 

 

Example output:

remi-php82                                                 Remi's PHP 8.2 RPM repository for Enterprise Linux 7 - x86_64                                345

 

 

6. Upgrade Packages:

Run the following command to upgrade packages:

# sudo yum update

 

7. Resolve IonCube Loader Issue (if applicable):

If you encounter an error related to IonCube loader when checking PHP version, follow these steps:

 

a. Download and Install IonCube Loaders Package:

Navigate to the desired location and download the package as a zip file:

cd /usr/local/

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

 

Extract the downloaded file:

tar -xvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local

 

 

 

b. Copy IonCube Loader Module:

Copy the IonCube loader module to the PHP module directory:

 

# cd /usr/local/ioncube/

sudo cp ioncube_loader_lin_8.2.so /usr/lib64/php/modules/

 

c. Update PHP Configuration:

Edit the PHP configuration file and replace the IonCube loader path with the correct one for PHP 8.2:

# Vim /etc/php.ini

 

 

Add or update the following line:

ioncube_loader_lin_8.2.so

 

8. Verify PHP Version:

Verify the PHP version again using the following command:

# php -v

 

 

 

9. Restart Services:

Restart the web server and PHP-FPM services:

# systemctl restart httpd

# systemctl restart php-fpm

 

 

Previous Next

Start Your Data Journey Today With MSAInfotech

Take the first step towards data-led growth by partnering with MSA Infotech. Whether you seek tailored solutions or expert consultation, we are here to help you harness the power of data for your business. Contact us today and let’s embark on this transformative data adventure together. Get a free consultation today!

We utilize data to transform ourselves, our clients, and the world.

Partnership with leading data platforms and certified talents

FAQ Robot

How Can We Help?

Captcha

MSA Infotech