1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Script to check if all required extensions are compiled and loaded in PHP
6
+ *
7
+ *
8
+ * We need the following mudules:
9
+ * - session
10
+ * - gmp
11
+ * - json
12
+ * - gettext
13
+ * - PDO
14
+ * - pdo_mysql
15
+ *
16
+ ************************************/
17
+
18
+
19
+ # Required extensions
20
+ $ requiredExt = array ("PDO " , "pdo_mysql " , "mbstring " , "iconv " , "ctype " , "gettext " , "gmp " , "json " , "filter " );
21
+
22
+ # Available extensions
23
+ $ availableExt = get_loaded_extensions ();
24
+
25
+ # Empty missing array to prevent errors
26
+ $ missingExt [0 ] = "" ;
27
+
28
+ # if not all are present create array of missing ones
29
+ foreach ($ requiredExt as $ extension ) {
30
+ if (!in_array ($ extension , $ availableExt )) {
31
+ $ missingExt [] = $ extension ;
32
+ }
33
+ }
34
+
35
+ # check for PEAR functions
36
+ if ((@include_once 'PEAR.php ' ) != true ) {
37
+ $ missingExt [] = "php PEAR support " ;
38
+ }
39
+
40
+ # if any extension is missing print error and die!
41
+ if (sizeof ($ missingExt ) != 1 || (phpversion () < "5.4 " ) || PHP_INT_SIZE ==4 ) {
42
+
43
+ /* remove dummy 0 line */
44
+ unset($ missingExt [0 ]);
45
+
46
+ /* Extensions error */
47
+ if (sizeof ($ missingExt )>0 ) {
48
+ $ error [] = _ ('The following required PHP extensions are missing ' );
49
+ foreach ($ missingExt as $ missing ) {
50
+ $ error [] = $ missing ;
51
+ }
52
+ $ error [] = _ ('Please recompile PHP to include missing extensions. ' );
53
+ }
54
+ /* php version error */
55
+ elseif (phpversion () < "5.4 " ) {
56
+ $ error [] = _ ('Unsupported PHP version ' );
57
+ $ error [] = _ ('From release 1.3.2+, at least PHP version 5.4 is required! ' );
58
+ $ error [] = _ ("Detected PHP version: " ).phpversion ();
59
+ }
60
+ /* 32-bit systems */
61
+ else {
62
+ $ error [] = _ ('From phpIPAM release 1.4 onwards, 64bit system is required! ' );
63
+ }
64
+
65
+ $ error [] = "" ;
66
+
67
+ die (implode ("\n" , $ error ));
68
+ }
0 commit comments