How to: Upgrade the System PHP Version

InterWorx utilizes its own, internal, version of PHP. This allows system administrators the freedom to choose the system-level version of PHP for the server.

Note

Unless otherwise specified, new installs of InterWorx will automatically update the system PHP version to a current stable version.

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

  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