svn commit: r435 - trunk/mapbender/http/tools/mapbender_setup.php

marko at osgeo.org marko at osgeo.org
Tue Jun 13 11:44:46 EDT 2006


Author: marko
Date: 2006-06-13 15:44:46+0000
New Revision: 435

Modified:
   trunk/mapbender/http/tools/mapbender_setup.php

Log:
new mapbender_setup script 

Modified: trunk/mapbender/http/tools/mapbender_setup.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/tools/mapbender_setup.php?view=diff&rev=435&p1=trunk/mapbender/http/tools/mapbender_setup.php&p2=trunk/mapbender/http/tools/mapbender_setup.php&r1=434&r2=435
==============================================================================
--- trunk/mapbender/http/tools/mapbender_setup.php	(original)
+++ trunk/mapbender/http/tools/mapbender_setup.php	2006-06-13 15:44:46+0000
@@ -1,112 +1,243 @@
 <?php
-#$Id: mapbender_setup.php,v 1.5 2006/02/06 07:50:25 astrid_emde Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/tools/mapbender_setup.php,v 1.5 2006/02/06 07:50:25 astrid_emde Exp $
+ # $ID$
+ # Copyright (C) 2002 CCGIS 
+ # 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 osgeo.org 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.
+ 
+ include_once("../../conf/mapbender.conf");
+ $con = @db_connect(DBSERVER,OWNER,PW);
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
 <html>
-<head>
-<meta name="author-mail" content="info at ccgis.de">
-<meta name="author" content="U. Rothstein">
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Mapbender Setup</title>
+	<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>
-<h3> Mapbender Setup</h3>
-<table border='1'>
-<?php
-
-
-include_once("../../conf/mapbender.conf");
-$con = @db_connect(DBSERVER,OWNER,PW);
-
-db_select_db(DB,$con);
-
-if (SYS_DBTYPE=="mysql"){
-	echo "<tr bgcolor='#ffffe0'><td>Administration Database</td><td>Connect to Database</td><td>PostGIS support</td></tr>";
-	echo "<tr><td>MySQL</td><td>";
-	if($con){echo "on";}
-	else{echo "off";}
-	echo "</td>";
-	echo "<td>";
-	
-	$con_string = "host=$GEOS_DBSERVER port=$GEOS_PORT dbname=$GEOS_DB user=$GEOS_OWNER password=$GEOS_PW";
-	
-	$con_postgis = pg_connect($con_string);
-	
-	if($con_postgis){
-		$sql = "Select postgis_version();";
-	    $res = pg_query($con_postgis,$sql);
-		if(!$res){
-			echo "<td>no PostGIS support</td>";
-		}else{
-			$cnt=0;
-			while(pg_fetch_row($res)){
-	  	 		echo "Version: ". pg_fetch_result($res,$cnt,0)."</td>";
-	     		$cnt++;
-			}
-			if ($cnt==0){
-				echo "<td>no PostGIS support</td>";
-			}
-		}
-	}else{
-		echo "<td> no connect</td>";
+<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">
+</tr></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'){
+		if (phpversion()<'5.1.0') $check .="<td width=\"10\"></td><td><font color=#0000FF>Version: " . phpversion() . "! you should think about upgrade to >=php5.1!</td></tr>";
+		else $check .="<td width=\"10\">X</td><td><font color=#00D000>Version: " . phpversion() . "</td></tr>";
 	}
-	echo "</td>";
-	echo "</table>";
-}else{
-	echo "<tr bgcolor='#d4d3d3'><td>Administration Database</td><td>Connect to Database</td><td>PostGIS support</td><td>md5</td></tr>";
-	echo "<tr><td>PostgreSQL</td><td>";
-	if($con){echo "on";}
-	else{echo "off";}
-	echo "</td>";
-
-	
-	echo "</td>";
-	if($con){
-		$sql = "Select postgis_version();";
-		$res = @db_query($sql);
-		if(!$res){
-			echo "<td>no PostGIS support</td>";
-		}else{
-			$row = db_fetch_array($res);
-			if ($row) {
-				echo "<td>on: VERSION ". $row[0]."</td>";
-			}else{
-				echo "<td>no PostGIS support</td>";
+	else $check .="<td width=\"10\"></td><td><font color=#FF0000>Version: " . phpversion() . "! your PHP is very old, think about upgrade to >=php5.1!</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>";
 			}
 		}
-		# md5 support
-		
+		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 = @db_query($sql);
-		if(!$res){
-			echo "<td>no md5 support</td>";
-		}else{
+		$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) {
-				echo "<td>md5 support</td>";
-			}else{
-				echo "<td>no md5 support</td>";
+			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{
-		echo "<td> no connect</td>";
-		echo "<td> no connect</td>";
+		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>Administration Database</td><td >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>";
+# PREPAREDSTATEMENTS
+	if (defined('PREPAREDSTATEMENTS')){
+		if (PREPAREDSTATEMENTS == true){
+			if (phpversion()<'5.1.0') $check.="<tr><td width=\"25%\">PREPAREDSTATEMENTS-<br>compatibility</td><td width=\"10\"></td><td><font color=\"#ff0000\">PREPAREDSTATEMENTS = true and php version " . phpversion() . " is incompatible<br>set PREPAREDSTATEMENTS to false or update php to >=5.1</td></tr>";
+			else $check .="<tr><td width=\"25%\">PREPAREDSTATEMENTS-<br>compatibility</td><td width=\"10\"><font color=#00D000>V</font></td><td><font color=#00D000>true and php " . phpversion() . " should work</td><tr/>";
+		}
+		else{
+			if (phpversion()<'5.1.0') $check .="<tr><td width=\"25%\">PREPAREDSTATEMENTS-<br>compatibility</td><td width=\"10\">X</td><td><font color=#00D000>false and php " . phpversion() . " should work </font><font color='#0000FF'> (but think about upgrading to php 5.1)</td><tr/>";
+			else $check .="<tr><td width=\"25%\">PREPAREDSTATEMENTS-<br>compatibility</td><td width=\"10\">X</td><td><font color=#00D000>false and php " . phpversion() . " should work <font color=#0000FF>(but you can set PREPAREDSTATEMENTS to 'true')</font></td><tr/>";
+		}
 	}
-	echo "</tr>";
-
+    else $check .="<tr><td width=\"25%\">PREPAREDSTATEMENTS-<br>compatibility</td><td width=\"10\"></td><td><font color=#FF0000>PREPAREDSTATEMENTS is not defined</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 "</table>";
-}
-
-echo "<br>File to start Mapbender: ";
-$path = LOGIN;
-echo "<a href='".$path."'>".$path."</a>";
-
-?>
-
-</body>
-</html>
+	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