<?php
if (!extension_loaded('json')) {
header('Content-Type: text/html');
echo 'Cannot load Extension JSON';
exit;
}
$response['status'] = true;
$response['message'] = '';
$response['phpversion'] = phpversion();
//php extension
$strPhpExtension = '';
$statusPhpExtension = true;
$aAllowPhpExtension = [
'mysqlnd', 'pdo', 'curl', 'iconv', 'mbstring', 'zip', 'json', 'fileinfo', 'exif', 'bcmath', 'ctype', 'openssl', 'tokenizer', 'xml', 'pdo_mysql'
];
foreach ($aAllowPhpExtension as $extensionName) {
if (!extension_loaded($extensionName)) {
$strPhpExtension = "{$strPhpExtension} '{$extensionName}',";
$statusPhpExtension = false;
}
}
if (!extension_loaded('gd') && !extension_loaded('imagick')) {
$strPhpExtension = $strPhpExtension . "'GD' or 'ImageMagick' ";
$statusPhpExtension = false;
}
$linkKbPhpExtension = '<a href="https://support.rvglobalsoft.com/hc/en-us/articles/900005115503-Create-site-error-Error-Please-allow-extension-mysqlnd-pdo-gd-curl-iconv-" target="_blank">How to resolve problem.</a>';
//Validate php extension
if ($statusPhpExtension == false) {
$response['message'] = $response['message'] . "<li>Please allow extension : {$strPhpExtension} {$linkKbPhpExtension}</li>";
$response['status'] = false;
}
//php memory_limit >= 64M
$linkKbPhpMemoryLimit = '<a href="https://support.rvglobalsoft.com/hc/en-us/articles/900005115083-Create-site-error-Error-Please-set-memory-limit-more-than-64-" target="_blank">How to resolve problem.</a>';
preg_match('/([0-9]+)/', ini_get('memory_limit'), $match);
if ($match[0] < 64) {
$response['message'] = $response['message'] . "<li>Please set memory_limit more than 64MB. {$linkKbPhpMemoryLimit}</li>";
$response['status'] = false;
}
//php max_execution_time >= 90
$linkKbPhpMemoryLimit = '<a href="https://support.rvglobalsoft.com/hc/en-us/articles/900005115123-Create-site-error-Error-Maximum-execution-time-of-30-seconds-exceeded-" target="_blank">How to resolve problem.</a>';
preg_match('/([0-9]+)/', ini_get('max_execution_time'), $match);
if ($match[0] < 90) {
$response['message'] = $response['message'] . "<li>Please set max_execution_time more than 90. {$linkKbPhpMemoryLimit}</li>";
$response['status'] = false;
}
/*
if (ini_get('allow_url_fopen') != 1) {
$response['message'] = $response['message'].' / php.ini, Must set allow_url_fopen=ON';
$response['status'] = false;
}
*/
//validate php function
$strPhpFunction = '';
$statusPhpFunction = true;
$aAllowPhpFunction = [
'posix_getpwuid', 'getmyuid', 'fileowner', 'stat', 'file_put_contents', 'parse_ini_file'
];
foreach ($aAllowPhpFunction as $functionName) {
if (!function_exists($functionName)) {
$strPhpFunction = $strPhpFunction . "'{$functionName}', ";
$statusPhpFunction = false;
}
}
$linkKbPhpFunction = '<a href="https://support.rvglobalsoft.com/hc/en-us/articles/900004161646-Create-site-error-Error-Please-allow-function-curl-json-parse-ini-file-file-put-contents-" target="_blank">How to resolve problem.</a>';
//Summary php function
if ($statusPhpFunction == false) {
$response['message'] = $response['message'] . "<li>Please allow function : {$strPhpFunction} {$linkKbPhpFunction}</li>";
$response['status'] = false;
}
if ($response['status'] == true) {
$response['message'] = "PHP Version, Extentsion, INI OK";
}
$response['phpini'] = '';
if (function_exists('php_ini_loaded_file')) {
$response['phpini'] = php_ini_loaded_file();
}
header('Content-type: application/json');
echo json_encode($response);
Copyright 2K16 - 2K18 Indonesian Hacker Rulez