| %s (%s) | %s | ', $name, $setting, $preferred);
if ($current == $preferred) {
$ret .= sprintf('%s', $current);
} else {
if ($red === true) {
$ret .= sprintf('%s', $current);
} else {
$ret .= sprintf('%s', $current);
}
if ($message) {
$ret .= ' (' . $message . ')';
}
}
$ret .= " | \n";
return $ret;
}
function stringSetting($name, $setting, $preferred, $red = true, $message = "") {
$current = ini_get($setting);
$ret = sprintf('| %s (%s) | %s | ', $name, $setting, $preferred);
if ($current == $preferred) {
$ret .= sprintf('%s', $current);
} else {
if ($red === true) {
$ret .= sprintf('%s', $current);
} else {
$ret .= sprintf('%s', $current);
}
if ($message) {
$ret .= ' (' . $message . ')';
}
}
$ret .= " |
\n";
return $ret;
}
function emptySetting($name, $setting) {
$current = ini_get($setting);
$ret = sprintf('| %s (%s) | unset | ', $name, $setting);
if (($current === false) or ($current === "")) {
$ret .= sprintf('unset');
} else {
$ret .= sprintf('Set: %s', $current);
}
$ret .= " |
\n";
return $ret;
}
function writablePath($name, $path) {
$ret = sprintf('| %s (%s) | ', $name, $path);
if (is_writable('../' . $path)) {
$ret .= sprintf('Writeable');
} else {
$ret .= sprintf('Unwriteable');
}
return $ret;
}
function prettySizeToActualSize($pretty) {
if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'G') {
return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024 * 1024;
}
if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'M') {
return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;
}
if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'K') {
return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;
}
return (int)$pretty;
}
function prettySize($v) {
$v = (float)$v;
foreach (array('B', 'K', 'M', 'G') as $unit) {
if ($v < 1024) {
return $v . $unit;
}
$v = $v / 1024;
}
}
function get_php_int_setting($val) {
$r = ini_get($val);
if ($r === false) {
return $r;
}
return prettySizeToActualSize($r);
}
function bigEnough($name, $setting, $preferred, $bytes = false, $red = true) {
$current = get_php_int_setting($setting);
if ($bytes === true) {
$ret = sprintf(' |
| %s (%s) | %s | ', $name, $setting, prettySize($preferred));
} else {
$ret = sprintf(' |
| %s (%s) | %s | ', $name, $setting, $preferred);
}
if ($current === false) {
$ret .= 'unset';
} else if ($current >= $preferred) {
if ($bytes === true) {
$ret .= sprintf('%s', prettySize($current));
} else {
$ret .= sprintf('%s', $current);
}
} else {
if ($bytes === true) {
$ret .= sprintf('%s', prettySize($current));
} else {
$ret .= sprintf('%s', $current);
}
}
$ret .= " |
\n";
return $ret;
}
function must_extension_loaded($ext, $message = "") {
@dl($ext);
if (extension_loaded($ext)) {
return 'Available';
}
if ($message) {
return 'Unavailable (' . $message . ')';
}
return 'Unavailable';
}
function can_extension_loaded($ext, $message = "") {
if (extension_loaded($ext)) {
return 'Available';
}
if ($message) {
return 'Unavailable (' . $message . ')';
}
return 'Unavailable';
}
$phpversion4 = phpversion() < '4' ? 'No (You need at least PHP 4)' : 'Yes';
$phpversion43 = phpversion() < '4.3' ? 'No (PHP 4.3 is recommended)' : 'Yes';
$phpversion5 = phpversion() >= '5' ? 'No (KnowledgeTree does not yet work with PHP5)' : 'Yes';
function running_user() {
if (substr(PHP_OS, 0, 3) == "WIN") {
return null;
}
if (extension_loaded("posix")) {
$uid = posix_getuid();
$userdetails = posix_getpwuid($uid);
return $userdetails['name'];
}
if (file_exists('/usr/bin/whoami')) {
return exec('/usr/bin/whoami');
}
if (file_exists('/usr/bin/id')) {
return exec('/usr/bin/id -nu');
}
return null;
}
function htaccess() {
if (array_key_exists('kt_htaccess_worked', $_SERVER)) {
return 'Your web server is set up to use the .htaccess files.
';
}
return 'Your web server is NOT set up to use the .htaccess files.
';
}
?>
KnowledgeTree Checkup
KnowledgeTree Checkup
This checkup allows you to check that your environment is ready to
support a KnowledgeTree installation, and that you can proceed to
configure your system. Red items are things to fix. Orange items means
you may not be having the ultimate experience unless the support is
added. Green items means you're ready to go in this area. You can
check back here to see if anything has changed in your environment if
you have any problems.
.htaccess file
You can let KnowledgeTree manage the PHP settings that apply to the
KnowledgeTree application (it won't affect your other applications) by
configuring your web server to use the .htaccess files that come with
KnowledgeTree. This will ensure that the settings for KnowledgeTree
(detailed below) are set up for optimal, reliable performance.
=htaccess()?>
PHP version and extensions
This relates to your PHP installation environment - which version of
PHP you are running, and which modules are available.
| PHP version 4.0 or above |
=$phpversion4?> |
| PHP version 4.3 or above |
=$phpversion43?> |
| PHP version below 5 |
=$phpversion5?> |
| Session support |
=must_extension_loaded('session');?> |
| MySQL support |
=must_extension_loaded('mysql');?> |
| Gettext support |
=can_extension_loaded('gettext', "Only needed for using non-English languages");?> |
| Fileinfo support |
=can_extension_loaded('fileinfo', "Provides better file identification support - not necessary if you use file extensions");?> |
PHP configuration
This relates to the configuration of PHP on your system.
Recommended settings
| Configuration option |
Recommended value |
Current value |
=boolSetting('Safe Mode','safe_mode','OFF')?>
=boolSetting('Display Errors','display_errors','ON', false, "Will be set correctly anyway.")?>
=boolSetting('Display Startup Errors','display_startup_errors','ON', false, "Will be set correctly anyway.")?>
=boolSetting('File Uploads','file_uploads','ON')?>
=boolSetting('Magic Quotes GPC','magic_quotes_gpc','OFF', false, "Quotes will be removed; not optimal")?>
=boolSetting('Magic Quotes Runtime','magic_quotes_runtime','OFF')?>
=boolSetting('Register Globals','register_globals','OFF', false, "Globals will be removed; not optimal, may be a security risk")?>
=boolSetting('Output Buffering','output_buffering','OFF')?>
=boolSetting('Session auto start','session.auto_start','OFF')?>
=emptySetting('Automatic prepend file','auto_prepend_file')?>
=emptySetting('Automatic append file','auto_append_file')?>
=stringSetting('Default MIME type', 'default_mimetype', 'text/html')?>
Limits
| Configuration option |
Recommended value |
Current value |
=bigEnough('Maximum POST size', 'post_max_size', 8 * 1024 * 1024, true)?>
=bigEnough('Maximum upload size', 'upload_max_filesize', 8 * 1024 * 1024, true)?>
=bigEnough('Memory limit', 'memory_limit', 8 * 1024 * 1024, true)?>
=""; # bigEnough('Maximum execution time', 'max_execution_time', 30)?>
=""; # bigEnough('Maximum input time', 'max_input_time', 60)?>
Paths
|
Session save path
|
,
Writeable' : 'Unwriteable';?>
|
|
Upload temporary path
|
Writeable' : 'Unwriteable';} ?>
|
Filesystem
=writablePath('Log directory', 'log')?>
log and Documents directories.";
} else {
$message = 'KnowledgeTree will be run as the ' . $username . ' system user, and must be able to write to the log and Documents directories.';
}
?>
| General |
=$message?> |
Post-installation checkup
Once you have installed, check the Post-installation checkup.