Commit 1f77c338 authored by Gary Allan's avatar Gary Allan
Browse files

Add check_php_build.php from phpipam/phpipam repository

We are re-using code from phpipam/phpipam that requires php5.4+ and 64bit OS.
parent 83cbdd74
......@@ -5,7 +5,7 @@ phpipam-agent is a scanning agent for phpipam server to be deployed to remote se
phpipam is released under the GPL v3 license, see misc/gpl-3.0.txt.
## Requirements
- PHP version 5.3+ with following modules
- 64bit PHP version 5.4+ with following modules
- pdo, pdo_mysql : Adds support for mysql connections (if type=mysql)
- gmp : Adds support for dev-libs/gmp (GNU MP library) -> to calculate IPv6 networks
- json : Adds supports for JSON data-interexchange format
......
<?php
/**
*
* Script to check if all required extensions are compiled and loaded in PHP
*
*
* We need the following mudules:
* - session
* - gmp
* - json
* - gettext
* - PDO
* - pdo_mysql
*
************************************/
# Required extensions
$requiredExt = array("PDO", "pdo_mysql", "mbstring", "iconv", "ctype", "gettext", "gmp", "json", "filter");
# Available extensions
$availableExt = get_loaded_extensions();
# Empty missing array to prevent errors
$missingExt[0] = "";
# if not all are present create array of missing ones
foreach ($requiredExt as $extension) {
if (!in_array($extension, $availableExt)) {
$missingExt[] = $extension;
}
}
# check for PEAR functions
if ((@include_once 'PEAR.php') != true) {
$missingExt[] = "php PEAR support";
}
# if any extension is missing print error and die!
if (sizeof($missingExt) != 1 || (phpversion() < "5.4") || PHP_INT_SIZE==4) {
/* remove dummy 0 line */
unset($missingExt[0]);
/* Extensions error */
if(sizeof($missingExt)>0) {
$error[] = _('The following required PHP extensions are missing');
foreach ($missingExt as $missing) {
$error[] = $missing;
}
$error[] = _('Please recompile PHP to include missing extensions.');
}
/* php version error */
elseif(phpversion() < "5.4") {
$error[] = _('Unsupported PHP version');
$error[] = _('From release 1.3.2+, at least PHP version 5.4 is required!');
$error[] = _("Detected PHP version: ").phpversion();
}
/* 32-bit systems */
else {
$error[] = _('From phpIPAM release 1.4 onwards, 64bit system is required!');
}
$error[] = "";
die(implode("\n", $error));
}
\ No newline at end of file
<?php
require( dirname(__FILE__) . '/checks/check_php_build.php' );
/* @config file ------------------ */
require_once( dirname(__FILE__) . '/classes/class.Config.php' );
$config = Config::ValueOf('config');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment