Zero logo

PHP Version Switching

The Uniform Server Zero XV provides switching between PHP versions 7.x and 8.x. To achieve this, you need to download a suitable PHP module for each version (for example, ZeroXV_php_7_x_x.exe or ZeroXV_php_8_x_x.exe), as explained below.

Switching overview

PHP Switching

In order to switch between PHP versions, environment variable PHP_SELECT is set to the selected PHP version. Valid values are php7x and php8x, x being the php series number installed on your system.

To ensure correct PHP configuration file is used, environment variable PHP_INI_SELECT is set to the selected PHP configuration file. Valid values are php_test.ini, php_development.ini and php_production.ini.

The PHP_SELECT environment variable is used in the Apache configuration file httpd.conf to select the appropriate configuration block that, in turn, selects a configuration file (for example, php8x.conf or php8y.conf).

Within the selected configuration file (for example, php8x.conf or php8y.conf), environment variable PHP_INI_SELECT selects the PHP configuration file to use.

The Apache configuration code for PHP switching is shown on the right.

Note: Configuration file (for example, php8x.conf or php8y.conf) is installed when a corresponding PHP module is installed.

PHP Modules

Related to PHP switching, when installing a module over an existing PHP series (for example, replacing ZeroXV_php_8_1_4.exe with ZeroXV_php_8_1_5.exe), it is assumed you want to use it instead of the one currently installed. This allows you to revert to an older version number within the same PHP series.


Apache configuration file: UniServerZ\core\apache2\conf\httpd.conf

# Environment variable ${PHP_SELECT} has a value of 
# php7x, php7y, (...), php8x, php8y, (...). It is used in the 
# following define statements to select a PHP version to
# load as a module.
Define ${PHP_SELECT}

<IfDefine php7x>
   Include ${US_ROOTF}/core/apache2/conf/extra_us/php7x.conf

<IfDefine php7y>
   Include ${US_ROOTF}/core/apache2/conf/extra_us/php7y.conf


<IfDefine php8x>
   Include ${US_ROOTF}/core/apache2/conf/extra_us/php8x.conf

<IfDefine php8y>
   Include ${US_ROOTF}/core/apache2/conf/extra_us/php8y.conf


Apache config file: UniServerZ\core\apache2\conf\extra_us\php7x.conf

  LoadFile ${US_ROOTF}/core/php7x/libsasl.dll
  LoadFile ${US_ROOTF}/core/php7x/icudtxx.dll
  LoadFile ${US_ROOTF}/core/php7x/icuinxx.dll
  LoadFile ${US_ROOTF}/core/php7x/icuioxx.dll
  LoadFile ${US_ROOTF}/core/php7x/iculexx.dll
  LoadFile ${US_ROOTF}/core/php7x/iculxxx.dll
  LoadFile ${US_ROOTF}/core/php7x/icuucxx.dll

 # Load PHP module and add handler
  LoadModule php7_module "${US_ROOTF}/core/php7x/php7apache2_4.dll"
  AddHandler application/x-httpd-php .php
 # Configure the path to php.ini
  PHPIniDir "${US_ROOTF}/core/php7x/${PHP_INI_SELECT}"

UniController PHP Switching

PHP Switching
  • Click version you wish to use (A-F).
  • Previous selection is deselected and new selection enabled.
  • Selected PHP version is indicated by a check marker (E).

Note 1: For the new settings to become effective, you must restart the Apache server.
Note 2: A greyed out button indicates that version is unavailable and you need to install an appropriate module.

PHP Switching

Installing a PHP module

Installing is a misnomer! Nothing is installed to your PCs registry. All files are extracted to their appropriate location within the UniServer folder structure.

The extraction procedure is identical for all module versions. Proceed as follows:

Install PHP module

  • If running, stop Apache and MySQL servers. Close Unicontroller.
  • Download required module installation file, for example ZeroXV_php_x_x_x.exe
  • Save the downloaded file to folder UniServerZ.
  • Double-click on the above installation file; this runs the self extracting archive.
  • If prompted, allow overwriting of existing files.
  • If you wish, delete the installation file; it is no longer required.

Clean Install

There are situations where you want to start from a clean installation. If the series (7x, 7y or 8x) you wish to install already exists, navigate to the core folder and delete the corresponding folder and file. You may then proceed with the extraction process.

For example, to completely remove php 7.x.29, delete folder:

  • C:\UniServerZ\core\php7x

and file:

  • C:\UniServerZ\core\apache2\conf\extra_us\php7x.conf

Enable The PHP module

Before the module is recognized, it requires selecting as follows:

  • Click version you wish to use (A-F).
  • Previous selection is deselected and new selection enabled.
  • Selected PHP version is indicated by a check marker (E).
  • Start Apache and the new version of PHP is recognized.
UniTray PHP Switching

Important information

The following lists important information that may catch you out.

Configuration files: Installing over an existing series will replace all configuration files. If you have made changes to the configuration files, save these files before installing a new version of the same series.

Extension artifacts: When installing over an existing series, there may be some extensions that are not included with the existing version. These extensions are not deleted and may be incompatible with the new version. It is recommended to perform a clean install as mentioned above.