$version="2008.01.23"; $testing=false; $error=0; $err_rep=0; $sapi=""; $charset1=""; $charset3=""; $apache_rheaders=array(); $gd_ver=0; $vars=array(); $exts=array(); $apache_charset=""; $disabled_funcs=array(); define('SE_WB_VER',0x00000001);define('SE_FILEMISSING',0x00000002);define('SE_MQRUNTIME',0x00000004);define('SE_CHARSETS',0x00000008); define('SE_SAFE',0x00000010);define('SE_SESSION',0x00000020);define('SE_DISFUNCS',0x00000040);define('SE_MYSQL_VER',0x00000080); define('SE_PHP_VER',0x00000100);define('SE_FILEUP',0x00000200);define('SE_ADDDEFAULTCHARSET',0x00000400);define('SE_NOTICE',0x00000800); define('SE_CURL',0x00001000);define('SE_GD',0x00002000);define('SE_CGI',0x00004000);define('SE_GD_VER',0x00008000); define('SE_MAXETIME',0x00010000);define('SE_MEMLIMIT',0x00020000);define('SE_UPLOADSIZE',0x00040000); function get_MBvalue($val) { $val=trim($val); $last=strtolower($val{ strlen($val)-1}); switch($last) { case 'g': $val*=1024; case 'm': $val*=1024; case 'k': $val*=1024; } $val/=1048576; return((int)$val); } print "

script-version: $version

"; print "

"; print "Checking mySQL
"; $ver_gt_40=TRUE; $result = mysql_query("SHOW VARIABLES LIKE 'version%'") or die("query:" . mysql_error()); while ($row = mysql_fetch_array($result)) { print $row[0]." : ".$row[1]."
"; if($row[0]=="version") { if($row[1][0]=="3" || ($row[1][0]=="4" && $row[1][2]=="0")) $ver_gt_40=FALSE; if($row[1][0]=="3") $error|=SE_MYSQL_VER; } } print "Checking mySQL character-sets
"; $result = mysql_query("SHOW VARIABLES LIKE 'character_set%'") or die("query:" . mysql_error()); while ($row = mysql_fetch_array($result)) { print $row[0]." : ".$row[1]."
"; if($row[0]=="character_set_connection") { $charset1=$row[1]; } } if($ver_gt_40==TRUE) { $result = mysql_query("SHOW CREATE DATABASE ".DB_NAME) or die("query:" . mysql_error()); while ($row = mysql_fetch_array($result)) { print $row[0]." : ".$row[1]."
"; } } $result = mysql_query("SHOW CREATE TABLE ".TABLE_PREFIX."settings") or die("query:" . mysql_error()); if($row = mysql_fetch_array($result)) { print $row[0]." : ".$row[1]."
"; preg_match("/DEFAULT CHARSET=([^\s]*).*$/", $row[1], $match); $charset3=$match[1]; } if($charset1!=$charset3) $error|=SE_CHARSETS; $result = mysql_query("SELECT @@global.sql_mode"); if($row = mysql_fetch_array($result)) { print "sql_mode : ".$row['@@global.sql_mode']."
"; } print ""; print "Checking PHP
"; print "Version: ".phpversion()."
"; if(version_compare(phpversion(), '4.1.0')<0) $error|=SE_PHP_VER; $sapi=php_sapi_name(); print "Server API: $sapi
"; if(strpos($sapi, 'cgi')!==FALSE) $error|=SE_CGI; $vars=ini_get_all(); print "default_charset: ".$vars['default_charset']['local_value']."
"; print "magic_quotes_gpc: ".$vars['magic_quotes_gpc']['local_value']."
"; print "magic_quotes_runtime: ".$vars['magic_quotes_runtime']['local_value']."
"; if(get_magic_quotes_runtime()) $error|=SE_MQRUNTIME; // any side-effects? print "max_execution_time: ".$vars['max_execution_time']['local_value']."
"; if($vars['max_execution_time']['local_value']<30) $error|=SE_MAXETIME; print "upload_max_filesize: ".$vars['upload_max_filesize']['local_value']."
"; if(get_MBvalue($vars['upload_max_filesize']['local_value'])<8) $error|=SE_UPLOADSIZE; print "post_max_size: ".$vars['post_max_size']['local_value']."
"; print "file_uploads: ".$vars['file_uploads']['local_value']."
"; if(ini_get("file_uploads")<>"1") $error|=SE_FILEUP; print "memory_limit: ".$vars['memory_limit']['local_value']."
"; if(get_MBvalue($vars['memory_limit']['local_value'])<16) $error|=SE_MEMLIMIT; print "max_input_time: ".$vars['max_input_time']['local_value']."
"; $exts=get_loaded_extensions(); print "loaded extensions: "; foreach($exts AS $ext) { print $ext." "; } print "
"; if(!in_array('curl', $exts)) $error|=SE_CURL; if(!in_array('session', $exts)) $error|=SE_SESSION; if(function_exists('gd_info')) { $ver_info = gd_info(); preg_match('/\d/', $ver_info['GD Version'], $match); $gd_ver = $match[0]; } if(!in_array("gd", $exts) || $gd_ver==1) $error|=SE_GD; if(in_array("gd", $exts) && $gd_ver==0) $error|=SE_GD_VER; print "safe_mode: ".$vars['safe_mode']['local_value']."
"; if(ini_get('safe_mode')) $error|=SE_SAFE; print "disable_functions: ".$vars['disable_functions']['local_value']."
"; if($vars['disable_functions']['local_value']!='') { if($disabled_funcs=explode(',', $vars['disable_functions']['local_value'])) $error|=SE_DISFUNCS; } print "session_support: "; print defined('SID')?"OK ":"DISABLED "; if(!defined('SID')) $error|=SE_SESSION; print "-- SID content: ".SID."
"; print "session.use_cookies: ".$vars['session.use_cookies']['local_value']."
"; print "session.use_only_cookies: ".$vars['session.use_only_cookies']['local_value']."
"; print "error_reporting: ".$vars['error_reporting']['local_value']."
"; $err_rep=(int)($vars['error_reporting']['local_value']); if($vars['error_reporting']['local_value']&=E_NOTICE) //Attn: this is really E_NOTICE, not SE_NOTICE! $error|=SE_NOTICE; print "display_errors: ".$vars['display_errors']['local_value']."
"; print ""; print "Checking WB:
"; require_once(ADMIN_PATH."/interface/version.php"); require_once(WB_PATH."/framework/functions.php"); print "WB_VERSION: ".WB_VERSION."
"; print "VERSION: ".VERSION."
"; if(VERSION!="2.6.7") $error|=SE_WB_VER; print "DEFAULT_CHARSET: ".DEFAULT_CHARSET."
"; print "OPERATING_SYSTEM: ".OPERATING_SYSTEM."
"; if(function_exists("apache_get_version")) { print ""; print "Checking Apache
"; print apache_get_version()."
"; } if(strpos($sapi, 'apache')!==FALSE || strpos($sapi, 'nsapi')!==FALSE) { flush(); $apache_rheaders=apache_response_headers(); if($testing) { $apache_rheaders[]='html; charset=iso-0000-0'; } foreach($apache_rheaders AS $h) { if(strpos($h, 'html; charset')!==FALSE) { print $h; preg_match('/charset=([a-zA-Z0-9- _]+)/', $h, $match); $apache_charset=$match[1]; if(strtolower($apache_charset)!=DEFAULT_CHARSET) $error|=SE_ADDDEFAULTCHARSET; } } } print "

"; if($testing) { $error=0xFFFFFFFF; $disabled_funcs=array('fsockopen','system','exec','shell_exec','ini_set','ini_restore','proc_open','passthru','set_time_limit','popen','php_uname','mail'); print "Script-Debugging-mode active! These are examples only!
"; } print "========================================

"; } else { if($error&SE_WB_VER) print "
  • ERROR: This is not Website Baker 2.6.7! Solution: update to Website Baker 2.6.7"; elseif($error&SE_FILEMISSING) print "
  • ERROR: necessary function or file missing! Solution: install or update failed. Try that again."; if($error&SE_CHARSETS) print "
  • WARN: connection-charset and table-default-charset differ! ($charset1 != $charset3)-- This will break your data content! Info: This will make some characters unreadable if you use e.g. greek or cyrillic chars! Western-European languages may work. Solution: If \"character-set-connection\" = latin1, then the table-charset within mySQL had to be latin1 (e.g. \"latin1_swedish_ci\"), too."; if($error&SE_SAFE) print "
  • ERROR: safe_mode in effect! -- You can't use Website Baker! Solution: Ask your webhoster to set Safe-Mode OFF."; if($error&SE_SESSION) print "
  • ERROR: session_support missing! -- You can't use Website Baker! Solution: Ask your webhoster to activate Session-Support"; if($error&SE_MYSQL_VER) print "
  • ERROR: mySQL < 4.0! -- You need at least mySQL 4.0!"; if($error&SE_PHP_VER) print "
  • ERROR: PHP < 4.1! -- You need at least PHP 4.1!"; if($error&SE_FILEUP) print "
  • ERROR: file-upload disabled. This will render some modules unuseable!"; if($error&SE_ADDDEFAULTCHARSET) print "
  • ERROR: Website Baker-charset and response-header-charset differ. -- This will break your data content! Solution: If you have access to the apache's httpd.conf (e.g. XAMP): don't use \"AddDefaultCharset\"! If you haven't access to the apache's config: add a .htaccess-file with \"php_value default_charset ".DEFAULT_CHARSET."\" to Website Baker's root-directory -- or use $apache_charset within Website Baker."; if($error&SE_MQRUNTIME) print "
  • NOTICE: magic_quotes_runtime in effect -- checkout side effects"; if($error&SE_DISFUNCS) { print "
  • disabled functions:"; } if($error&SE_NOTICE) print "
  • NOTICE: error_reporting includes E_NOTICE, you will see some extra messages. Solution: add a .htaccess-file with \"php_value error_reporting ".($err_rep-8)."\""; if($error&SE_CURL) print "
  • WARN: extension 'curl' missing -- you can't use 'Curl Module'. Solution: use a different module."; if($error&SE_GD) print "
  • WARN: extension 'gd >2.0' missing -- Captcha will fail! You can't use these modules: gallery, imagegallery, gdpics, smoothgallery, gocart, aggregator (with thumbs), news (with tumbs)"; if($error&SE_CGI) print "
  • NOTICE: PHP as CGI: you can't use .htaccess-files."; if($error&SE_GD_VER) print "
  • NOTICE: extension 'gd' exists, but can't determine version. You need at least version 2.0!"; if(in_array('fsockopen', $disabled_funcs) && in_array('mail', $disabled_funcs)) print "
  • ERROR: you can't use email at all - neither SMTP nor PHP's mail(). This will render some functionality unusable."; elseif(in_array('fsockopen', $disabled_funcs) && in_array('ini_set', $disabled_funcs)) print "
  • WARN: you can't use phpmailer(SMTP), but PHP's mail() may fail."; if($error&SE_MAXETIME) print "
  • WARN: max_execution_time < 30sec. This is uncommon and MAY result in problems! Solution: try to add a .htaccess-file with \"php_value max_execution_time 30\""; if($error&SE_MEMLIMIT) print "
  • WARN: memory_limit < 16MB. This is uncommon and MAY result in problems! Solution: try to add a .htaccess-file with \"php_value memory_limit 16777216\""; if($error&SE_UPLOADSIZE) print "
  • Notice: upload_max_filesize < 8MB. You can't upload large files or pictures. Solution: try to add a .htaccess-file with \"php_value upload_max_filesize 8388608\""; print "

    "; if(($error&SE_ADDDEFAULTCHARSET || $error&SE_NOTICE) && !$error&SE_CGI) { print "

    Note: Some webhosters doesn't allow use of .htaccess-files, or restrict the use -- they may offer a config-tool (CONFIXX or similar) instead, to provide this functionality.

    "; } print "Note: Explanation of terms --
    ERROR: To make use of Website Baker, you have to change the server-configuration!
    WARN: You can use Website Baker, but special attention is needed.
    NOTICE: You can use Website Baker without harm, but there may some odd behavior"; } print "

    "; if(function_exists('memory_get_peak_usage')) print "Max memory-usage while processing this script: ".round(memory_get_peak_usage(true)/1024/1024.0,2) ."MByte
    "; elseif(function_exists('memory_get_usage')) print "Memory-usage while processing this script: about ".round(memory_get_usage()/1024/1024.0,2) ."MByte
    "; print "

    ";