Example #1
0
function OX_increaseMemoryLimit($setMemory)
{
    $phpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes();
    if ($phpMemoryLimitInBytes == -1) {
        return true;
    }
    if ($setMemory > $phpMemoryLimitInBytes) {
        if (@ini_set('memory_limit', $setMemory) === false) {
            return false;
        }
    }
    return true;
}
 /**
  * A private method to test the configuration of the user's PHP environment.#
  *
  * Tests the following values, and in the event of a fatal error or a
  * warning, the value set is listed below:
  *
  *  - The PHP version
  *      Sets: $this->aInfo['PHP']['warning']['version']
  *
  *  - The PHP configuration's memory_limit value
  *      Sets: $this->aInfo['PHP']['warning']['memory_limit']
  *
  *  - The PHP configuration's safe_mode value
  *      Sets: $this->aInfo['PHP']['error']['safe_mode']
  *
  *  - The PHP configuration's magic_quotes_runtime value
  *      Sets: $this->aInfo['PHP']['error']['magic_quotes_runtime']
  *
  *  - The PHP configuration's file_uploads value
  *      Sets: $this->aInfo['PHP']['error']['file_uploads']
  *
  *  - The PHP configuration's pcre extension
  *      Sets: $this->aInfo['PHP']['error']['pcre']
  *
  *  - The PHP configuration's xml extension
  *      Sets: $this->aInfo['PHP']['error']['xml']
  *
  *  - The PHP configuration's zlib extension
  *      Sets: $this->aInfo['PHP']['error']['zlib']
  *
  *  - The PHP configuration's database (both mysql and pgsql) extensions
  *      Sets: $this->aInfo['PHP']['error']['mysql']
  *
  *  - The PHP configuration's spl extension
  *      Sets: $this->aInfo['PHP']['error']['spl']
  *
  *  - The PHP configuration's timeout settings
  *      Sets: $this->aInfo['PHP']['error']['timeout']
  *
  * Otherwise, if there are no errors or warnings, then $this->aInfo['PHP']['error']
  * is set to "false".
  *
  * @access private
  * @return integer One of the following values:
  *                      - OA_ENV_ERROR_PHP_NOERROR
  *                      - OA_ENV_ERROR_PHP_VERSION
  *                      - OA_ENV_ERROR_PHP_SAFEMODE
  *                      - OA_ENV_ERROR_PHP_MAGICQ
  *                 Note that sometimes an error value is returned, sometimes
  *                 not, even if there is an actual error - this appears to be
  *                 a historical hangover, where the information set in the
  *                 $this->aInfo array has gradually assumed more importance
  *                 than the return value.
  *
  * @TODO Address the return value oddness, by removing all return values, and
  *       simply rely on the $this->aInfo array, perhaps?
  */
 function _checkCriticalPHP()
 {
     // Test the PHP version
     if (!function_exists('version_compare')) {
         // The user's PHP version is very old - it doesn't
         // even have the version_compare() function!
         $result = OA_ENV_ERROR_PHP_VERSION;
     } else {
         if (version_compare($this->aInfo['PHP']['actual']['version'], $this->aInfo['PHP']['expected']['version'], "<")) {
             $result = OA_ENV_ERROR_PHP_VERSION;
         } else {
             $result = OA_ENV_ERROR_PHP_NOERROR;
         }
     }
     if ($result == OA_ENV_ERROR_PHP_VERSION) {
         $this->aInfo['PHP']['warning']['version'] = "Version {$this->aInfo['PHP']['actual']['version']} is below the minimum supported version of {$this->aInfo['PHP']['expected']['version']}." . "<br />You should upgrade your PHP to at least {$this->aInfo['PHP']['expected']['version']} in order to install " . PRODUCT_NAME . ". " . "Please see the <a href='" . PRODUCT_DOCSURL . "/faq'>FAQ</a> for more information.";
     } else {
         $this->aInfo['PHP']['error'] = false;
     }
     // Test the original memory_limit
     if (!$this->checkOriginalMemory()) {
         $this->aInfo['PHP']['warning']['memory_limit'] = PRODUCT_NAME . " requires a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB to run successfully, although " . "some parts of the application will increase this limitation if required. The current 'memory_limit' value is set to " . $this->aInfo['PHP']['actual']['original_memory_limit'] / 1048576 . " MB, so " . PRODUCT_NAME . " has automatically increased " . "this limit. If possible, please increase the 'memory_limit' value in your server's php.ini file to a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB before continuing.";
     }
     // Ensure that the original memory_limit is not displayed in the systems screen
     unset($this->aInfo['PHP']['actual']['original_memory_limit']);
     // Test the PHP configuration's safe_mode value
     if ($this->aInfo['PHP']['actual']['safe_mode']) {
         $result = OA_ENV_ERROR_PHP_SAFEMODE;
         $this->aInfo['PHP']['error']['safe_mode'] = 'The safe_mode option must be OFF';
     }
     // Test the PHP configuration's magic_quotes_runtime value
     if ($this->aInfo['PHP']['actual']['magic_quotes_runtime']) {
         $result = OA_ENV_ERROR_PHP_MAGICQ;
         $this->aInfo['PHP']['error']['magic_quotes_runtime'] = 'The magic_quotes_runtime option must be OFF';
     }
     // Test the PHP configuration's file_uploads value
     if (!$this->aInfo['PHP']['actual']['file_uploads']) {
         $this->aInfo['PHP']['error']['file_uploads'] = 'The file_uploads option must be ON';
     }
     // Test the required PHP extensions are loaded
     if (!$this->aInfo['PHP']['actual']['pcre']) {
         $this->aInfo['PHP']['error']['pcre'] = 'The pcre extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['xml']) {
         $this->aInfo['PHP']['error']['xml'] = 'The xml extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['zlib']) {
         $this->aInfo['PHP']['error']['zlib'] = 'The zlib extension must be loaded';
     }
     if (!($this->aInfo['PHP']['actual']['mysql'] || $this->aInfo['PHP']['actual']['pgsql'])) {
         $this->aInfo['PHP']['error']['mysql'] = 'Either the mysql or the pgsql extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['spl']) {
         $this->aInfo['PHP']['error']['spl'] = 'The spl extension must be loaded';
     }
     if ($this->aInfo['PHP']['actual']['mbstring.func_overload']) {
         $this->aInfo['PHP']['error']['mbstring.func_overload'] = 'mbstring function overloading must be disabled';
     }
     if ($this->aInfo['PHP']['actual']['timeout']) {
         $this->aInfo['PHP']['error']['timeout'] = 'The PHP function set_time_limit() has been disabled and ' . 'max_execution_time is set to ' . $this->aInfo['PHP']['actual']['timeout'] . ' which may cause problems with functionality such as maintenance';
     }
     if (!empty($this->aInfo['PHP']['error'])) {
         $this->aInfo['PHP']['error']['badPhpConfiguration'] = $GLOBALS['strSystemCheckBadPHPConfig'];
     }
     return $result;
 }
Example #3
0
 /**
  * A private method to test the configuration of the user's PHP environment.#
  *
  * Tests the following values, and in the event of a fatal error or a
  * warning, the value set is listed below:
  *
  *  - The PHP version
  *      Sets: $this->aInfo['PHP']['warning'][OA_ENV_ERROR_PHP_VERSION]
  *
  *  - The PHP configuration's memory_limit value
  *      Sets: $this->aInfo['PHP']['warning'][OA_ENV_WARNING_MEMORY]
  *
  *  - The PHP configuration's safe_mode value
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_SAFEMODE]
  *
  *  - The PHP configuration's magic_quotes_runtime value
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_MAGICQ]
  *
  *  - The PHP configuration's file_uploads value
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_UPLOADS]
  *
  *  - The PHP configuration's pcre extension
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_PCRE]
  *
  *  - The PHP configuration's xml extension
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_XML]
  *
  *  - The PHP configuration's zlib extension
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_ZLIB]
  *
  *  - The PHP configuration's database (both mysql and pgsql) extensions
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_MYSQL]
  *
  *  - The PHP configuration's timeout settings
  *      Sets: $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_TIMEOUT]
  *
  * Otherwise, if there are no errors or warnings, then $this->aInfo['PHP']['error']
  * is set to "false".
  *
  * @access private
  * @return integer One of the following values:
  *                      - OA_ENV_ERROR_PHP_NOERROR
  *                      - OA_ENV_ERROR_PHP_VERSION
  *                      - OA_ENV_ERROR_PHP_VERSION_NEWER
  *                      - OA_ENV_ERROR_PHP_SAFEMODE
  *                      - OA_ENV_ERROR_PHP_MAGICQ
  *                 Note that sometimes an error value is returned, sometimes
  *                 not, even if there is an actual error - this appears to be
  *                 a historical hangover, where the information set in the
  *                 $this->aInfo array has gradually assumed more importance
  *                 than the return value.
  *
  * @TODO Address the return value oddness, by removing all return values, and
  *       simply rely on the $this->aInfo array, perhaps?
  */
 function _checkCriticalPHP()
 {
     // Test the PHP version
     if (function_exists('version_compare')) {
         $result = version_compare($this->aInfo['PHP']['actual']['version'], $this->aInfo['PHP']['expected']['version'], "<");
         if ($result) {
             $result = OA_ENV_ERROR_PHP_VERSION;
         } elseif (!empty($this->aInfo['PHP']['expected']['version_new'])) {
             $result = version_compare($this->aInfo['PHP']['actual']['version'], $this->aInfo['PHP']['expected']['version_new'], ">=");
             if ($result) {
                 $result = OA_ENV_ERROR_PHP_VERSION_NEWER;
             } else {
                 $result = OA_ENV_ERROR_PHP_NOERROR;
             }
         } else {
             $result = OA_ENV_ERROR_PHP_NOERROR;
         }
     } else {
         // The user's PHP version is well old - it doesn't
         // even have the version_compare() function!
         $result = OA_ENV_ERROR_PHP_VERSION;
     }
     if ($result == OA_ENV_ERROR_PHP_VERSION) {
         $this->aInfo['PHP']['warning'][OA_ENV_ERROR_PHP_VERSION] = "Version {$this->aInfo['PHP']['actual']['version']} is below the minimum supported version of {$this->aInfo['PHP']['expected']['version']}." . "<br />Although you can install OpenX, this is not a supported version, and it is not possible to guarantee that everything will work correctly. " . "Please see the <a href='" . OX_PRODUCT_DOCSURL . "/faq/php-unsupported'>FAQ</a> for more information.";
     } elseif ($result == OA_ENV_ERROR_PHP_VERSION_NEWER) {
         $this->aInfo['PHP']['warning'][OA_ENV_ERROR_PHP_VERSION_NEWER] = "Version {$this->aInfo['PHP']['actual']['version']} is not supported yet." . "<br />Although you can install OpenX, this is not a supported version, and it is not possible to guarantee that everything will work correctly. " . "Please see the <a href='" . OX_PRODUCT_DOCSURL . "/faq/php-unsupported'>FAQ</a> for more information.";
     } else {
         $this->aInfo['PHP']['error'] = false;
     }
     // Test the original memory_limit
     if (!$this->checkOriginalMemory()) {
         $this->aInfo['PHP']['warning'][OA_ENV_WARNING_MEMORY] = MAX_PRODUCT_NAME . " requires a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB to run successfully, although " . "some parts of the application will increase this limitation if required. The current 'memory_limit' value is set to " . $this->aInfo['PHP']['actual']['original_memory_limit'] / 1048576 . " MB, so " . MAX_PRODUCT_NAME . " has automatically increased " . "this limit. If possible, please increase the 'memory_limit' value in your server's php.ini file to a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB before continuing.";
     }
     // Ensure that the original memory_limit is not displayed in the systems screen
     unset($this->aInfo['PHP']['actual']['original_memory_limit']);
     // Test the PHP configuration's safe_mode value
     if ($this->aInfo['PHP']['actual']['safe_mode']) {
         $result = OA_ENV_ERROR_PHP_SAFEMODE;
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_SAFEMODE] = 'The safe_mode option must be OFF';
     }
     // Test the PHP configuration's magic_quotes_runtime value
     if ($this->aInfo['PHP']['actual']['magic_quotes_runtime']) {
         $result = OA_ENV_ERROR_PHP_MAGICQ;
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_MAGICQ] = 'The magic_quotes_runtime option must be OFF';
     }
     // Test the PHP configuration's file_uploads value
     if (!$this->aInfo['PHP']['actual']['file_uploads']) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_UPLOADS] = 'The file_uploads option must be ON';
     }
     // Test the required PHP extensions are loaded
     if (!$this->aInfo['PHP']['actual']['pcre']) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_PCRE] = 'The pcre extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['xml']) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_XML] = 'The xml extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['zlib']) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_ZLIB] = 'The zlib extension must be loaded';
     }
     if (!($this->aInfo['PHP']['actual']['mysql'] || $this->aInfo['PHP']['actual']['pgsql'])) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_MYSQL] = 'Either the mysql or the pgsql extension must be loaded';
     }
     if ($this->aInfo['PHP']['actual']['timeout']) {
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_TIMEOUT] = 'The PHP function set_time_limit() has been disabled and ';
         $this->aInfo['PHP']['error'][OA_ENV_ERROR_PHP_TIMEOUT] .= 'max_execution_time is set to ' . $this->aInfo['PHP']['actual']['timeout'] . ' which may cause problems with functionality such as maintenance';
     }
     return $result;
 }
 /**
  * A private method to test the configuration of the user's PHP environment.#
  *
  * Tests the following values, and in the event of a fatal error or a
  * warning, the value set is listed below:
  *
  *  - The PHP version
  *      Sets: $this->aInfo['PHP']['warning']['version']
  *
  *  - The PHP configuration's memory_limit value
  *      Sets: $this->aInfo['PHP']['warning']['memory_limit']
  *
  *  - The PHP configuration's safe_mode value
  *      Sets: $this->aInfo['PHP']['error']['safe_mode']
  *
  *  - The PHP configuration's magic_quotes_runtime value
  *      Sets: $this->aInfo['PHP']['error']['magic_quotes_runtime']
  *
  *  - The PHP configuration's file_uploads value
  *      Sets: $this->aInfo['PHP']['error']['file_uploads']
  *
  *  - The PHP configuration's pcre extension
  *      Sets: $this->aInfo['PHP']['error']['pcre']
  *
  *  - The PHP configuration's xml extension
  *      Sets: $this->aInfo['PHP']['error']['xml']
  *
  *  - The PHP configuration's zlib extension
  *      Sets: $this->aInfo['PHP']['error']['zlib']
  *
  *  - The PHP configuration's database (both mysql and pgsql) extensions
  *      Sets: $this->aInfo['PHP']['error']['mysql']
  *
  *  - The PHP configuration's spl extension
  *      Sets: $this->aInfo['PHP']['error']['spl']
  *
  *  - The PHP configuration's timeout settings
  *      Sets: $this->aInfo['PHP']['error']['timeout']
  *
  * Otherwise, if there are no errors or warnings, then $this->aInfo['PHP']['error']
  * is set to "false".
  *
  * @access private
  * @return integer One of the following values:
  *                      - OA_ENV_ERROR_PHP_NOERROR
  *                      - OA_ENV_ERROR_PHP_VERSION
  *                      - OA_ENV_ERROR_PHP_VERSION_54
  *                      - OA_ENV_ERROR_PHP_VERSION_55
  *                      - OA_ENV_ERROR_PHP_SAFEMODE
  *                      - OA_ENV_ERROR_PHP_MAGICQ
  *                 Note that sometimes an error value is returned, sometimes
  *                 not, even if there is an actual error - this appears to be
  *                 a historical hangover, where the information set in the
  *                 $this->aInfo array has gradually assumed more importance
  *                 than the return value.
  *
  * @TODO Address the return value oddness, by removing all return values, and
  *       simply rely on the $this->aInfo array, perhaps?
  */
 function _checkCriticalPHP()
 {
     // Due to https://bugs.php.net/bug.php?id=65367 we need to blacklist PHP
     // 5.4.0-5.4.19 and 5.5.0-5.5.1
     // Test the PHP version
     if (function_exists('version_compare')) {
         if (version_compare($this->aInfo['PHP']['actual']['version'], $this->aInfo['PHP']['expected']['version'], "<")) {
             $result = OA_ENV_ERROR_PHP_VERSION;
         } elseif (version_compare($this->aInfo['PHP']['actual']['version'], '5.4.0', ">=") && version_compare($this->aInfo['PHP']['actual']['version'], '5.4.20', "<")) {
             if (preg_match('#^5\\.4\\.4-14\\+deb7u(\\d+)$#', $this->aInfo['PHP']['actual']['version'], $m) && $m[1] >= 9) {
                 // Thanks Debian for backporting the fix into 5.4.4-14+deb7u9
                 $result = OA_ENV_ERROR_PHP_NOERROR;
             } else {
                 $result = OA_ENV_ERROR_PHP_VERSION_54;
             }
         } elseif (version_compare($this->aInfo['PHP']['actual']['version'], '5.5.0', ">=") && version_compare($this->aInfo['PHP']['actual']['version'], '5.5.2', "<")) {
             $result = OA_ENV_ERROR_PHP_VERSION_55;
         } else {
             $result = OA_ENV_ERROR_PHP_NOERROR;
         }
     } else {
         // The user's PHP version is well old - it doesn't
         // even have the version_compare() function!
         $result = OA_ENV_ERROR_PHP_VERSION;
     }
     if ($result == OA_ENV_ERROR_PHP_VERSION) {
         $this->aInfo['PHP']['warning']['version'] = "Version {$this->aInfo['PHP']['actual']['version']} is below the minimum supported version of {$this->aInfo['PHP']['expected']['version']}." . "<br />Although you can install " . PRODUCT_NAME . ", this is not a supported version, and it is not possible to guarantee that everything will work correctly. " . "Please see the <a href='" . PRODUCT_DOCSURL . "/faq'>FAQ</a> for more information.";
     } elseif ($result == OA_ENV_ERROR_PHP_VERSION_54 || $result == OA_ENV_ERROR_PHP_VERSION_55) {
         $this->aInfo['PHP']['error']['version'] = "Version {$this->aInfo['PHP']['actual']['version']} is not supported due to a bug that prevents " . PRODUCT_NAME . " from working properly." . "<br />You should upgrade your PHP to at least 5.4.20 or 5.5.2 in order to propery install " . PRODUCT_NAME . ". " . "Please see the <a href='" . PRODUCT_DOCSURL . "/faq'>FAQ</a> for more information.";
         // Exit immediately
         return $result;
     } else {
         $this->aInfo['PHP']['error'] = false;
     }
     // Test the original memory_limit
     if (!$this->checkOriginalMemory()) {
         $this->aInfo['PHP']['warning']['memory_limit'] = PRODUCT_NAME . " requires a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB to run successfully, although " . "some parts of the application will increase this limitation if required. The current 'memory_limit' value is set to " . $this->aInfo['PHP']['actual']['original_memory_limit'] / 1048576 . " MB, so " . PRODUCT_NAME . " has automatically increased " . "this limit. If possible, please increase the 'memory_limit' value in your server's php.ini file to a minimum of " . OX_getMemoryLimitSizeInBytes() / 1048576 . " MB before continuing.";
     }
     // Ensure that the original memory_limit is not displayed in the systems screen
     unset($this->aInfo['PHP']['actual']['original_memory_limit']);
     // Test the PHP configuration's safe_mode value
     if ($this->aInfo['PHP']['actual']['safe_mode']) {
         $result = OA_ENV_ERROR_PHP_SAFEMODE;
         $this->aInfo['PHP']['error']['safe_mode'] = 'The safe_mode option must be OFF';
     }
     // Test the PHP configuration's magic_quotes_runtime value
     if ($this->aInfo['PHP']['actual']['magic_quotes_runtime']) {
         $result = OA_ENV_ERROR_PHP_MAGICQ;
         $this->aInfo['PHP']['error']['magic_quotes_runtime'] = 'The magic_quotes_runtime option must be OFF';
     }
     // Test the PHP configuration's file_uploads value
     if (!$this->aInfo['PHP']['actual']['file_uploads']) {
         $this->aInfo['PHP']['error']['file_uploads'] = 'The file_uploads option must be ON';
     }
     // Test the required PHP extensions are loaded
     if (!$this->aInfo['PHP']['actual']['pcre']) {
         $this->aInfo['PHP']['error']['pcre'] = 'The pcre extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['xml']) {
         $this->aInfo['PHP']['error']['xml'] = 'The xml extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['zlib']) {
         $this->aInfo['PHP']['error']['zlib'] = 'The zlib extension must be loaded';
     }
     if (!($this->aInfo['PHP']['actual']['mysql'] || $this->aInfo['PHP']['actual']['pgsql'])) {
         $this->aInfo['PHP']['error']['mysql'] = 'Either the mysql or the pgsql extension must be loaded';
     }
     if (!$this->aInfo['PHP']['actual']['spl']) {
         $this->aInfo['PHP']['error']['spl'] = 'The spl extension must be loaded';
     }
     if ($this->aInfo['PHP']['actual']['mbstring.func_overload']) {
         $this->aInfo['PHP']['error']['mbstring.func_overload'] = 'mbstring function overloading must be disabled';
     }
     if ($this->aInfo['PHP']['actual']['timeout']) {
         $this->aInfo['PHP']['error']['timeout'] = 'The PHP function set_time_limit() has been disabled and ' . 'max_execution_time is set to ' . $this->aInfo['PHP']['actual']['timeout'] . ' which may cause problems with functionality such as maintenance';
     }
     if (!empty($this->aInfo['PHP']['error'])) {
         $this->aInfo['PHP']['error']['badPhpConfiguration'] = $GLOBALS['strSystemCheckBadPHPConfig'];
     }
     return $result;
 }
/**
 * Check for situation when installing or using software is eithe
 * imposible, or results in unformated error output, due to system
 * configuration.
 *
 * @param &$aErrors Array of error mesages. All errors that it is possible to
 *                  detect will be set, regardless of the function return value.
 * @return bool|int True on system check OK, negative int value on detected problems.
 *                         -1 => The "function_exists" built-in function doesn't exist
 *                         -2 => At least one of the "strpos" or "parse_url" built-in
 *                               functions don't exist
 *                         -3 => One of the other required built-in functions was
 *                               detected as being disabled
 *                         -4 => The amount of memory required was too low
 *
 */
function RV_checkSystemInitialRequirements(&$aErrors)
{
    // Variables for tracking if the test has passed or not,
    // and if not, what value to return
    $isSystemOK = true;
    $return = true;
    // The general list of built in PHP functions that are required to
    // run Revive Adserver, apart from the functions:
    //
    //   - "function_exists"
    //   - "array_intersect"
    //   - "explode"
    //   - "ini_get"
    //   - "trim"
    //   - "parse_url"
    //   - "strpos"
    //
    // These other functions are tested separately, as they are
    // required to test for the existence of the functions in the
    // array below!
    $aRequiredFunctions = array('dirname', 'empty', 'file_exists', 'ini_set', 'parse_ini_file', 'version_compare', 'set_include_path');
    // Prepare error strings, in the simplest possible way
    $errorString1 = 'The built in PHP function "';
    $errorString2 = '" is in the "disable_functions" list in your "php.ini" file.';
    // Need "function_exists" to be able to test for functions required
    // for testing what is in the "disabled_functions" list
    if (!function_exists('function_exists')) {
        $aErrors[] = $errorString1 . 'function_exists' . $errorString2;
        // Cannot detect any more errors, as function_exists is
        // needed to detect the required functions!
        return -1;
    }
    // Test for existence of "parse_url" and "strpos", which are
    // special cases required for the display of the error message
    // in the event of anything failing in this test!
    if (!function_exists('parse_url')) {
        $aErrors[] = $errorString1 . 'parse_url' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -2;
        }
    }
    if (!function_exists('strpos')) {
        $aErrors[] = $errorString1 . 'strpos' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -2;
        }
    }
    // Test for existence of "array_intersect", "explode", "ini_get"
    // and "trim", which are all required as part of the code to test
    // which functions are in the "disabled_functions" list below...
    if (!function_exists('array_intersect')) {
        $aErrors[] = $errorString1 . 'array_intersect' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('explode')) {
        $aErrors[] = $errorString1 . 'explode' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('ini_get')) {
        $aErrors[] = $errorString1 . 'ini_get' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('trim')) {
        $aErrors[] = $errorString1 . 'trim' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    // Test the disabled functons list with required functions list
    // defined above in $aRequiredFunctions
    $aDisabledFunctions = explode(',', ini_get('disable_functions'));
    foreach ($aDisabledFunctions as $key => $value) {
        $aDisabledFunctions[$key] = trim($value);
    }
    $aNeededFunctions = array_intersect($aDisabledFunctions, $aRequiredFunctions);
    if (count($aNeededFunctions) > 0) {
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
        foreach ($aNeededFunctions as $functionName) {
            $aErrors[] = $errorString1 . $functionName . $errorString2;
        }
    }
    // Check PHP version, as use of the minimum required version of PHP > 5.5.9
    // may result in parse errors, which we want to avoid
    $errorMessage = "PHP version 5.5.9, or greater, was not detected.";
    if (function_exists('version_compare')) {
        $result = version_compare(phpversion(), '5.5.9', '<');
        if ($result) {
            $aErrors[] = $errorMessage;
            $isSystemOK = false;
            if ($return === true) {
                $return = -3;
            }
        }
    }
    // Check minimum memory requirements are okay (24MB)
    $minimumRequiredMemory = OX_getMinimumRequiredMemory();
    $phpMemoryLimit = OX_getMemoryLimitSizeInBytes();
    if ($phpMemoryLimit > 0 && $phpMemoryLimit < $minimumRequiredMemory) {
        // The memory limit is too low, but can it be increased?
        $memoryCanBeSet = OX_checkMemoryCanBeSet();
        if (!$memoryCanBeSet) {
            $minimumRequiredMemoryInMB = $minimumRequiredMemory / 1048576;
            $errorMessage = 'The PHP "memory_limit" value is set to less than the required minimum of ' . $minimumRequiredMemoryInMB . 'MB, but because the built in PHP function "ini_set" ' . 'has been disabled, the memory limit cannot be automatically increased.';
            $aErrors[] = $errorMessage;
            $isSystemOK = false;
            if ($return === true) {
                $return = -4;
            }
        }
    }
    if (!$isSystemOK) {
        return $return;
    }
    return true;
}