Note

You are viewing the documentation for an older release of Interworx (8.0). To see documentation for the current generally available release of Interworx, click here: 8.2.

How To: Upgrade the System PHP Version

InterWorx does not directly control or dictate the system PHP version for the server. Server Administrators may upgrade the system PHP version to whatever version they desire. This task must be performed via the CLI.

Note

Unless otherwise specified, when InterWorx is installed, the default version of PHP that comes with the OS will be upgraded to a current stable version. This is the only time that InterWorx automatically upgrades the system PHP version for the server.

Warning

This documentation should only be used to upgrade the existing system PHP version to a higher version.

Downgrading the system PHP version requires different steps and is not recommended due to potential unforeseen compatibility issues that may arise with other packages.

To Upgrade the System PHP Version in EL7

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. Check the current PHP version. In this example, the server is currently using PHP 8.0:

    [root@server ~]# php -v
    PHP 8.0.27 (cli) (built: Jan  3 2023 16:17:26) ( NTS gcc x86_64 )
    Copyright (c) The PHP Group
    Zend Engine v4.0.27, Copyright (c) Zend Technologies
    [root@server ~]#
    
  3. Enable the repo for the desired PHP version. The following example uses PHP 8.1:

    yum-config-manager --enable remi-php81
    
  4. Use the following yum command to upgrade the PHP version and related installed packages:

    yum upgrade php*
    
  5. Check the PHP version, again, to make sure that it was updated:

    [root@server ~]# php -v
    PHP 8.1.14 (cli) (built: Jan  4 2023 06:45:14) (NTS gcc x86_64)
    Copyright (c) The PHP Group
    Zend Engine v4.1.14, Copyright (c) Zend Technologies
    [root@server ~]#
    
  6. Run the following to refresh the PHP versions available to InterWorx. This will also update the Webserver page in NodeWorx to reflect the change. This command can take 15-30 seconds to resolve:

    ~iworx/bin/php-fpm.pex --refresh-available-versions
    

To Upgrade the System PHP Version in EL8 and EL9

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. Check the current PHP version. In this example, the server is currently using PHP 8.0:

    [root@almainstalltest ~]# php -v
    PHP 8.0.28 (cli) (built: Feb 14 2023 11:05:44) ( NTS gcc x86_64 )
    Copyright (c) The PHP Group
    Zend Engine v4.0.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.28, Copyright (c), by Zend Technologies
    [root@almainstalltest ~]#
    
  3. Reset the PHP module

    dnf module reset php
    
  4. Use the module install command to upgrade the PHP version and related installed packages, replacing {version} with the desired PHP version

    dnf -y module install php:remi-{version}
    
    • For example, this is the command to update the system PHP version to PHP 8.1:

      dnf -y module install php:remi-8.1
      
  5. Check the PHP version, again, to make sure that it was updated:

      [root@server ~]# php -v
      PHP 8.1.19 (cli) (built: May 10 2023 13:43:03) (NTS gcc x86_64)
      Copyright (c) The PHP Group
      Zend Engine v4.1.19, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.19, Copyright (c), by Zend Technologies
      [root@server ~]#
    
  6. Run the following to refresh the PHP versions available to InterWorx. This will also update the Webserver page in NodeWorx to reflect the change. This command can take 15-30 seconds to resolve:

    ~iworx/bin/php-fpm.pex --refresh-available-versions