File: 1.09.2b/server/web/environment.test.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeNATS 4: 5: FreeNATS is (C) Copyright 2008-2010 PurplePixie Systems 6: 7: FreeNATS is free software: you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation, either version 3 of the License, or 10: (at your option) any later version. 11: 12: FreeNATS is distributed in the hope that it will be useful, 13: but WITHOUT ANY WARRANTY; without even the implied warranty of 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15: GNU General Public License for more details. 16: 17: You should have received a copy of the GNU General Public License 18: along with FreeNATS. If not, see www.gnu.org/licenses 19: 20: For more information see www.purplepixie.org/freenats 21: -------------------------------------------------------------- */ 22: 23: function test_funcs($funcs) 24: { 25: if (!is_array($funcs)) $funcs=array($funcs); 26: $out=""; 27: for($a=0; $a 28: { 29: if (!function_exists($funcs[$a])) 30: { 31: $out.=$funcs[$a]." "; 32: } 33: } 34: if ($out!="") $out.="functions required"; 35: return $out; 36: } 37: 38: function test_mod($mod,$funcs) 39: { 40: $text=test_funcs($funcs); 41: if ($text=="") 42: { 43: echo "".$mod." - Ok
";
44: return true; 45: } 46: else 47: { 48: echo "".$mod." - ".$text."
";
49: return false; 50: } 51: } 52: 53: if (!isset($env_test_web)) // PHP CLI Test 54: { 55: if (!test_mod("IMAP","imap_open")) 56: { 57: echo "IMAP is not supported - don't configure IMAP tests or your environment will hang
";
58: } 59: if (!test_mod("Sockets","fsockopen")) 60: { 61: echo "Sockets are not supported - fatal error
";
62: } 63: if (!test_mod("Streams","fopen")) 64: { 65: echo "Streams are not supported - fatal error
";
66: } 67: if (!test_mod("MySQL","mysql_connect")) 68: { 69: echo "MySQL is not supported - fatal error
";
70: } 71: if (!test_mod("Mail","mail")) 72: { 73: echo "mail() not supported, may have to use direct SMTP or maybe no mail will work!
";
74: } 75: if (!test_mod("PHP5","str_split")) 76: { 77: echo "Don't appear to be running PHP5 - FreeNATS may not work on PHP4
";
78: } 79: if (!test_mod("XML","xml_parser_create")) 80: { 81: echo "XML Parser not present in PHP CLI - nodeside testing and anything else dependent on XML (discovery/import tools etc) will fail!
";
82: } 83: exit(1); 84: } 85: else // PHP Web/Apache Module Test 86: { 87: if (!test_mod("MySQL","mysql_connect")) 88: { 89: echo "MySQL is not supported - fatal error
";
90: } 91: if (!test_mod("Mail","mail")) 92: { 93: echo "mail() not supported, may have to use direct SMTP or maybe no mail will work!
";
94: } 95: if (!test_mod("PHP5","str_split")) 96: { 97: echo "Don't appear to be running PHP5 - FreeNATS may not work on PHP4
";
98: } 99: if (!test_mod("GD Graphics",array("imagecreate","imagepng"))) 100: { 101: echo "GD Graphics does not appear to be supported or does not support PNG - historic graphs will not work!
";
102: } 103: if (!test_mod("XML","xml_parser_create")) 104: { 105: echo "XML Parser not present in PHP web - nodeside and other functions from within the web interface will fail
";
106: } 107: } 108: 109: ?> 110: