File: phptest.php

package info (click to toggle)
phpsysinfo 3.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,900 kB
  • sloc: javascript: 22,511; php: 20,651; xml: 18,293; sh: 196; python: 58; makefile: 12
file content (74 lines) | stat: -rw-r--r-- 2,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
function echoinfo($extension) {
    echo "                                    ".$extension;
    switch(strtolower($extension)) {
        case 'json':
            echo " - reqired for bootstrap and xml json mode";
            break;
        case 'simplexml':
        case 'pcre':
        case 'dom':
        case 'xml':
//            echo " - reqired";
            break;
        case 'com_dotnet':
            echo " - reqired on WINNT systems";
            break;
        case 'snmp':
            echo " - reqired for snmppinfo plugin and snmpups";
            break;
        case 'pfsense':
            echo " - loaded on pfSense system";
            break;
        case 'mbstring':
            echo " - reqired on non UTF-8 and non CP437 systems";
            break;
        case 'xsl':
            echo " - reqired for static mode";
    }
    echo "\n";
}

header('Content-Type: text/plain');

if (isset($_SERVER["SERVER_SOFTWARE"])) {
    echo "SERVER SOFTWARE: ".$_SERVER["SERVER_SOFTWARE"]."\n";
}
echo "PHP VERSION: ".PHP_VERSION;
if (version_compare("5.1.3", PHP_VERSION, ">")) {
    echo " - PHP 5.1.3 or greater is required!!!";
}
echo "\n";

echo "PHP EXTENSIONS:\n";
$arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring', 'com_dotnet', 'json', 'xsl', 'snmp', 'pfsense');
$extensions = get_loaded_extensions();
$extarray = array();
foreach ($extensions as $extension) {
    $extarray[strtolower($extension)] = $extension;
}

$first = true;
foreach ($arrReq as $extension) if (isset($extarray[$extension])) {
    if ($first) {
        echo "                requred loaded:\n";
        $first = false;
    }
    echoinfo($extarray[$extension]);
}
$first = true;
foreach ($arrReq as $extension) if (!isset($extarray[$extension])) {
    if ($first) {
        echo "                requred not loaded:\n";
        $first = false;
    }
    echoinfo($extension);
}
$first = true;
foreach ($extarray as $extlower=>$extension) if (!in_array($extlower, $arrReq, true)) {
    if ($first) {
        echo "                others loaded:\n";
        $first = false;
    }
    echoinfo($extension);
}