Frequently Asked Question

PHP Update or Downgrade
Last Updated 53 minutes ago

To update or downgrade PHP on a RHEL-based distribution (such as AlmaLinux, Rocky Linux, or CentOS Stream) using the Remi repository, follow the steps below.

Prerequisites

Before changing PHP versions, ensure the CodeReady Builder (CRB) repository is enabled and the Remi repository is installed.

    sudo dnf config-manager --set-enabled crb
    sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
  1. Enable CRB and install Remi:

Updating PHP (e.g., to PHP 8.5)

To switch to a newer version of PHP, you must reset the current module stream and enable the desired version.

    sudo dnf module reset php
    sudo dnf module enable php:remi-8.5
    sudo dnf update php*
  1. Reset the current PHP module:
  2. Enable the new PHP version (e.g., 8.5):
  3. Update all PHP packages:

Downgrading PHP (e.g., to PHP 8.3)

To revert to an older version, follow the same module reset process but enable the older version stream.

    sudo dnf module reset php
    sudo dnf module enable php:remi-8.3
    sudo dnf distro-sync
  1. Reset the current PHP module:
  2. Enable the older PHP version (e.g., 8.3):
  3. Synchronise the system to install the downgraded packages:

Important Notes

    sudo systemctl restart php-fpm
    sudo systemctl restart httpd  # or nginx
    php -v
  • Web Server Restart: After changing PHP versions, you must restart your web server (e.g., Apache or Nginx) and PHP-FPM service to apply the changes.
  • Module Dependencies: If you have specific PHP extensions installed (such as php-mysqlnd, php-gd, etc.), ensure they are available for the new version. The dnf update or dnf distro-sync commands usually handle this, but you may need to manually install missing extensions if they are not part of the base module stream.
  • Verify Version: Check the active PHP version after the process is complete:

``

This FAQ was generated and/or edited by GAIN, GENs Artificial Intelligence Network and should not be considered 100% accurate. Always check facts and do your research, things change all the time. If you are unsure about any information provided, please raise a support ticket for clarification.
This website relies on temporary cookies to function, but no personal data is ever stored in the cookies.
OK
Powered by GEN UK CLEAN GREEN ENERGY

Loading ...