svn commit: r411 - trunk/mapbender/http/tools/mb_setupcheck.php

marko at osgeo.org marko at osgeo.org
Sun Jun 11 17:37:53 EDT 2006


Author: marko
Date: 2006-06-11 21:37:53+0000
New Revision: 411

Added:
   trunk/mapbender/http/tools/mb_setupcheck.php   (contents, props changed)

Log:


Added: trunk/mapbender/http/tools/mb_setupcheck.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/tools/mb_setupcheck.php?view=auto&rev=411
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/tools/mb_setupcheck.php	2006-06-11 21:37:53+0000
@@ -0,0 +1,364 @@
+<?php
+ #
+ # Created on 18.05.2006/10:03:40
+ #  
+ # http://www.mapbender.org/index.php/Installation_en
+ # Projekt: mapbender
+ # File: mb_setupchecker.php
+ #
+ # by Marko Samson 
+ # contact marko.samson at web.de or marko.samson at wald-und-holz.nrw.de
+ # created with PHPeclipse
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2, or (at your option)
+ # any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #
+ # Version 
+ # 0.1 -first version
+ # 0.2 -infotable instead of simple list
+ #     -some more checks included
+ # 0.3 -mapbender css style included and adatpted design to mapbenderindexstyle
+ # 	   -GNU GPL license included
+ #     -Link to wiki page included
+ # 0.4 
+ #     
+ # 
+ # INFO:
+ # Just copy to your_htdocs_directory/mapbender/http/tools/ and it should work
+ # 
+ #
+ include_once("../../conf/mapbender.conf");
+ $con = @db_connect(DBSERVER,OWNER,PW);
+?>
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+	<head><meta http-equiv="cache-control" content="no-cache">
+	<meta http-equiv="pragma" content="no-cache">
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="robots" content="noindex,nofollow">
+	<title>Mapbender Setupchecker</title>
+</head>
+<link rel="stylesheet" type="text/css" href="../css/mapbender.css">
+
+<body>
+
+<TABLE  BGCOLOR="#ffffff" width="70%" height="70%" ALIGN="top" CELLSPACING="0" CELLPADDING="10" STYLE="-moz-border-radius:8px; border:2px #000000 solid;">
+<TR><TD VALIGN="center" STYLE="margin-bottom:0px; padding-bottom:0px;">
+
+<H1 style="padding:0px; margin:0px; font:32px/32px bold Arial,Helvetica,sans-serif; font-stretch:extra-expanded;font-weight:bold">
+<font align="left"" style="font-weight:bold" color="#000000">&nbsp;Ma</font><font color="#0000CE" style="font-weight:bold">p</font><font color="#C00000">b</font><font color="#000000" style="font-weight:bold">ender</font>
+</H1>
+<font color="#000000" style="font-weight:bold">Setup-Checker</font>
+<br>
+<HR STYLE="color:#629093; height:2px; margin:0px; padding:0px;" WIDTH="100%" NOSHADE COLOR="#808080">
+</TD></TR>
+
+<TR>
+
+<TD VALIGN="TOP">
+<table style="border: 2px solid rgb(128, 128, 128); -moz-border-radius-topleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px; -moz-border-radius-bottomleft: 8px;" bgcolor=#dddddd cellspacing=0 cellpadding=0 width="95%">
+<th colspan="3" bgcolor=#F0F0F0>PHP Configurationcheck</th>
+<?php
+###########################################
+#PHP Configurationcheck
+###########################################
+
+#######
+#phpversion
+#######
+$check ="<tr ><td  width=\"25%\">php Version</td>";
+if (phpversion()<'4.3.0') 
+	$check .="<td width=\"10\"></td><td><font color=#FF0000>Version:" . phpversion() . "? your PHP-Version is rather old!</td></tr>";
+else 
+	$check .="<td width=\"10\">X</td><td><font color=#00D000>Version:" . phpversion() . "</td></tr>";
+#######
+#php-schnittstelle 
+#######
+if(php_sapi_name() == 'cgi')
+	$check.="<tr><td >interface</td><td>X</td><td><font color=#00D000>CGI-PHP</td></tr>";
+else	
+	$check.="<tr><td >interface</td><td>X</td><td><font color=#00D000>Modul-PHP</td></tr>";
+#######
+# path to php.ini
+#######
+if (!get_cfg_var('cfg_file_path')) 
+	$check .="<tr ><td>path to php.ini</td><td></td><td><font color=#FF0000>No Path to php.ini found</font></td></tr>";
+else 
+	$check .="<tr ><td>path to php.ini</td><td>X</td><td><font color=#00D000>" . get_cfg_var('cfg_file_path') . "</font></td></tr>";
+#######
+# extension dir
+#######
+if (!get_cfg_var('extension_dir')||get_cfg_var('extension_dir')=='')
+	$check .="<tr ><td>extension_dir</td><td></td><td><font color=#FF0000>no extension_dir set!</font></td></tr>";
+else 
+	$check .="<tr ><td>extension_dir</td><td>X</td><td><font color=#00D000>" . get_cfg_var('extension_dir') . "</font><font color='#0000FF'>(check the path, is it correct?)</font></td></tr>"; 
+#######
+# session.save_path
+####### 
+if (!get_cfg_var('session.save_path'))
+	$check .="<tr ><td>session.save_path</td><td></td><td><font color=#FF0000>please configure a session.save_path!</font></td></tr>";
+else 
+	$check .="<tr ><td>session.save_path</td><td>X</td><td><font color=#00D000>" . get_cfg_var('session.save_path') . " </font><font color='#0000FF'>(check out the authorisation of the dir)</font></td></tr>"; 
+#######
+# memory_limit
+#######
+if (get_cfg_var('memory_limit'))
+	$check .="<tr ><td>memory Limit</td><td>X</td><td><font color=#00D000>" . get_cfg_var('memory_limit') . "</font><font color='#0000FF'> (running in memory-trouble with printing? Perhaps raise your memory limit)</font></td></tr>";
+else
+	$check .="<tr ><td>memory Limit</td><td></td><td><font color=#FF0000>memory_limit must be set (30M will be enough for the moment)</font></td></tr>";
+#######
+# error_reporting
+#######
+$check .="<tr ><td>error-reporting</td>";
+ if (get_cfg_var('error_reporting')!=2039) 
+ 	$check .="<td></td><td><font color=#FF0000>please set error_reporting to 'E_ALL & ~E_NOTICE' except for testing</td></tr>";
+ else 
+ 	$check .="<td>X</td><td><font color=#00D000>ok, error_reporting = E_ALL & ~E_NOTICE </td></tr>";
+#######
+# session.save_handler
+#######
+if (!get_cfg_var('session.save_handler')||get_cfg_var('session.save_handler')!='files')
+	$check .="<tr ><td>session.save_handler</td><td></td><td><font color=#FF0000>session.save_handler must be set to 'session.save_handler = files'!</font></td></tr>";
+else 
+	$check .="<tr ><td>session.save_handler</td><td>X</td><td><font color=#00D000>session.save_handler = " . get_cfg_var('session.save_handler') . "</font></td></tr>"; 
+#######
+# file_uploads
+####### 
+$check .="<tr><td>file_Uploads</td>";
+ if (get_cfg_var('file_uploads')=='1') 
+ 	$check .= "<td>X</td><td><font color=#00D000>On</font></td></tr>";
+ else 
+ 	$check .= "<td></td><td><font color=#FF0000>Off</font></td></tr>";
+#######
+# allow_url_fopen
+#######
+$check .="<tr ><td>allow_url_fopen</td>"; 
+if (get_cfg_var('allow_url_fopen')=='1')
+	$check .= "<td>X</td><td><font color=#00D000>On</font></td></tr>";
+else 
+	$check .= "<td></td><td><font color=#FF0000>Off =>allow_url_fopen must be on read <a href='http://www.mapbender.org/index.php/Allow_url_fopen' target=_blank>this</a></font></td></tr>";
+echo $check;
+#################################################
+#PHP Extensioncheck
+#################################################
+
+#######
+#MYSQL
+#######
+?>
+</table>
+<br><br>
+<table style="border: 2px solid rgb(128, 128, 128); -moz-border-radius-topleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px; -moz-border-radius-bottomleft: 8px;" bgcolor=#dddddd cellspacing=0 cellpadding=0 width="95%">
+<th colspan="3" bgcolor=#F0F0F0>PHP Extensioncheck</th>
+<?php
+if(!extension_loaded('mysql'))
+	$check="<tr ><td width=\"25%\">MySQL check</td><td width=\"10\"></td><td><font color=#FF0000 >MySQL not installed! You have to include mysql-extension!)</font></td></tr>";
+else
+	$check="<tr ><td width=\"25%\">MySQL check</td><td width=\"10\">X</td><td><font color=#00D000 >MySQL installed</font></td></tr>";
+
+#######
+#PGSQL
+#######
+if(!extension_loaded('pgsql'))
+	$check.="<tr><td>PostgreSQL check</td><td></td><td><font color=#FF0000>PostgreSQL not installed (You must have MySQL or PostgreSQL)</font></td></tr>";
+else
+	$check.="<tr><td>PostgreSQL check</td><td>X</td><td><font color=#00D000>PostgreSQL installed</font></td></tr>";
+#######
+#GD
+#######
+if(extension_loaded('gd'))
+	$check.="<tr ><td>GD2 check</td><td>X</td><td><font color=#00D000>GD installed</font></td></tr>";
+else
+	$check.="<tr ><td>GD2 check</td><td></td><td><font color=#FF0000>GD not installed (no printing possible)</font></td></tr>";
+#######
+#mbstring
+#######
+if(extension_loaded('mbstring'))
+	$check.="<tr ><td>MbString check</td><td>X</td><td><font color=#00D000>MbString installed</font></td></tr>";
+else
+	$check.="<tr ><td>MbString check</td><td></td><td><font color=#FF0000>MbString not installed</font></td></tr>";
+echo $check;
+
+
+####################################
+# Database check
+####################################
+?>
+</table>
+<br><br>
+<table style="border: 2px solid rgb(128, 128, 128); -moz-border-radius-topleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px; -moz-border-radius-bottomleft: 8px;" bgcolor=#dddddd cellspacing=0 cellpadding=0 width="95%">
+<th colspan="3" bgcolor=#F0F0F0>Database check</th>
+<?php
+
+db_select_db(DB,$con);
+
+if (SYS_DBTYPE=="mysql")
+{
+	$check = "<tr ><td width=\"25%\">Administration Database</td><td>X</td><td><font color=#00D000>MySQL</td><tr>";
+	$check .= "<tr ><td>Connect to Database</td>";
+	if($con)
+		$check .="<td width=\"10\">X</td><td><font color=#00D000>connected</font></td></tr>";
+	else
+		$check .="<td width=\"10\"></td><td><font color=#FF0000>not connected</font></td></tr>";
+	$check .="<tr><td colspan=3><b>PostGIS function check</b></td></tr>";
+	$con_string = "host= " . GEOS_DBSERVER . " port=" . GEOS_PORT . " dbname=" . GEOS_DB . " user=" . GEOS_OWNER . " password=" .GEOS_PW;
+	if (pg_connect($con_string))
+	{
+		pg_connect($con_string);
+		$con_postgis = pg_connect($con_string);
+		$sql = "Select postgis_full_version();";
+		$res = pg_query($con_postgis,$sql);
+		if(!$res)
+			$check .="<tr width=\"20%\><td>PostGIS support</td><td></td><td><font color=#FF0000>no PostGIS function available</tr>";
+		else{
+			$cnt=0;
+			while(pg_fetch_row($res))
+			{
+				$check .="<tr><td>PostGIS support</td><td>X</td><td><font color=#00D000>PostGIS function available</tr>";
+				$check .="<tr><td>Version</td><td>X</td><td><font color=#00D000>" . pg_fetch_result($res,$cnt,0). "</td></tr>";
+	  		  	$cnt++;
+	  		}
+	
+			if ($cnt==0)
+			$check .="<tr><td>PostGIS support</td><td></td><td><font color=#FF0000>no PostGIS function available</tr>";
+		}
+	}
+	else
+		$check .="<tr><td>Postgis support</td><td></td><td><font color=#FF0000>no PostGIS function available</font></tr>";
+	echo $check;
+
+}
+else
+{
+	$check = "<tr><td width=\"25%\">Administration Database</td><td>X</td><td><font color=#00D000>PostgreSQL</td><tr>";
+	$check .= "<tr><td>Connect to Database</td>";
+	if($con)
+		$check .="<td width=\"10\">X</td><td><font color=#00D000>connected</font></td></tr>";
+	else
+		$check .="<td width=\"10\"></td><td><font color=#FF0000>not connected</font></td></tr>";
+	# md5 support
+		
+	$sql = "Select md5('root');";
+	$res = pg_query($sql);
+	if(!$res)
+		$check .="<tr><td>MD5 support</td><td></td><td><font color=#FF0000>no md5 support</td></tr>";
+	else{
+		$row = db_fetch_array($res);
+		if ($row) 
+			$check .="<tr><td>MD5 support</td><td>X</td><td><font color=#00D000>md5 supported</td></tr>";
+		else
+			$check .="<tr><td>MD5 support</td><td></td><td><font color=#FF0000>no md5 support</td></tr>";
+	}
+echo $check;	
+######################################
+# PostGIS check
+######################################	
+?>
+</table>
+<br><br>
+<table style="border: 2px solid rgb(128, 128, 128); -moz-border-radius-topleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px; -moz-border-radius-bottomleft: 8px;" bgcolor=#dddddd cellspacing=0 cellpadding=0 width="95%">
+<th colspan="3" bgcolor=#F0F0F0>PostGIS check</th>
+<?php
+	$check ="";
+	if ($con)
+	{
+		$sql = "Select postgis_full_version();";
+		if (pg_query($con,$sql))
+		 $res = pg_query($con,$sql);
+		else 
+		 echo "<tr><td><font>pg_query($con,$sql)";
+		if(!$res)
+			$check .="<tr><td width=\"25%\">PostGIS support</td><td width=\"10\"></td><td><font color=#FF0000>no PostGIS function available</tr>";
+		else
+		{
+			$cnt=0;
+			
+			while(pg_fetch_row($res)){
+				$check .="<tr><td width=\"25%\">PostGIS support</td><td width=\"10\">X</td><td><font color=#00D000>PostGIS function available</tr>";
+				$check .="<tr><td>Version</td><td width=\"10\">X</td><td><font color=#00D000>" . pg_fetch_result($res,$cnt,0). "</td></tr>";
+	  		  	$cnt++; 	
+	  		}
+			if ($cnt==0)
+			$check .="<tr><td width=\"25%\">PostGIS support</td><td width=\"10\"></td><td><font color=#FF0000>no PostGIS function available</tr>";
+		}
+	}
+	else
+	$check .="<tr><td width=\"25%\">Postgis support</td><td width=\"10\"></td><td><font color=#FF0000>no PostGIS function available</font></tr>";
+	echo $check;
+
+} 
+#################################
+# Mapbender configuration check
+#################################
+?>
+</table>
+<br><br>
+<table style="border: 2px solid rgb(128, 128, 128); -moz-border-radius-topleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px; -moz-border-radius-bottomleft: 8px;" bgcolor=#dddddd cellspacing=0 cellpadding=0 width="95%">
+<th colspan="3" bgcolor=#F0F0F0>mapbender.conf check</th>
+<?php
+
+#######
+# SYS_DBTYPE
+#######
+	
+if (SYS_DBTYPE == 'mysql' || SYS_DBTYPE == 'pgsql')
+	$check ="<tr><td width=\"25%\">Administration Database</td><td width=\"10\">X</td><td><font color=#00D000>" . SYS_DBTYPE . "</font></td></tr>";
+else
+	$check ="<tr><td width=\"25%\">Administration Database</td><td width=\"10\"></td><td><font color=#FF0000>" . SYS_DBTYPE . " is not defined for mysql or pgsql</font></td></tr>";
+#######
+# DBSERVER
+#######	
+if (DBSERVER !="<HOST>" && DBSERVER != "")
+	$check .="<tr><td>DB-Server</td><td>X</td><td><font color=#00D000>" . DBSERVER . "</font><font color='#0000FF'> (is this your DB-Server)</font></td></tr>";
+else 	
+ 	$check .="<tr><td>DB-Server</td><td></td><td><font color=#FF0000>" . DBSERVER . " is not defined</font></td></tr>";
+#######
+# Mapbender-DB
+#######
+if (DB !="<database>" && DB != "")
+	$check .="<tr><td>Mapbender-DB</td><td>X</td><td><font color=#00D000>" . DB . "</font><font color='#0000FF'> (is this your Mapbender-DB)</font></td></tr>";
+else 	
+ 	$check .="<tr><td>Mapbender-DB</td><td></td><td><font color=#FF0000>" . DB . " is not defined</font></td></tr>";
+######
+# DB Owner
+######
+if (OWNER !="<owner>" && OWNER != "")
+	$check .="<tr><td>DB-Owner</td><td>X</td><td><font color=#00D000>" . OWNER . "</font><font color='#0000FF'> (is this your DB-Owner)</font></td></tr>";
+else 	
+ 	$check .="<tr><td>DB-Owner</td><td></td><td><font color=#FF0000>" . OWNER . " is not defined</font></td></tr>";
+######
+# MD5 check
+######
+if (MD5 =="true")
+	$check .="<tr><td>MD-check</td><td>X</td><td><font color=#00D000>" . MD5 . "</font></td></tr>";
+else 	
+ 	$check .="<tr><td>MD-check</td><td></td><td><font color=#FF0000>" . MD5 . " =>MD5 is disabled. Think about using MD5!</font></td></tr>";
+######
+# Login Path
+######
+$check .= "<tr height=10/><tr><td>Login-Path</td><td colspan=2><a href='" . LOGIN . "' target='_blank'>" . LOGIN . "</a><br><font color=#0000FF> (if this link doesn't work, check out your 'URL to Login' in your mapbender.conf<br>Perhaps an alias in your httpd.conf will solve the prob')</td>"; 	 	 	
+
+echo $check;	
+
+echo "<tr height=10/><tr bgcolor=#F0F0F0><td colspan=3>Legend:<br><font color=#FF0000>red = maybe your Mapbender will run into trouble</font><br><font color=#0000FF>blue = just a tip</font><br><font color=#00D000>green = seems to be alright</font></td></tr>";
+#echo "<tr height=20><tr><td colspan=3 align=right>for further informations visit <a href=\"http://www.mapbender.org/index.php/Installation_en\" parent=\"_self \"><font align=\"left\" style=\"font-weight:bold\" color=\"#000000\">&nbsp;Ma</font><font color=\"#0000CE\" style=\"font-weight:bold\">p</font><font color=\"#C00000\" style=\"font-weight:bold\">b</font><font color=\"#000000\" style=\"font-weight:bold\">ender</font> installation instructions</a></td></tr>";
+echo "</table>";
+echo "<tr><td colspan=3 align=right>for further informations visit <a href=\"http://www.mapbender.org/index.php/Installation_en\" target=\"_blank\"><font align=\"left\" style=\"font-weight:bold\" color=\"#000000\">&nbsp;Ma</font><font color=\"#0000CE\" style=\"font-weight:bold\">p</font><font color=\"#C00000\" style=\"font-weight:bold\">b</font><font color=\"#000000\" style=\"font-weight:bold\">ender</font> installation instructions</a></td></tr>";
+?>
+</td></tr>
+</table>
+</body> 
+</html>
\ No newline at end of file




More information about the Mapbender_commits mailing list