.
*
* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
* must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
*/
error_reporting(E_ALL);
//require_once('../config/dmsDefaults.php');
function get_php_setting($val) {
$r = (ini_get($val) == '1' ? 1 : 0);
return $r ? 'ON' : 'OFF';
}
function boolSetting($name, $setting, $preferred, $red = true, $message = "") {
$current = get_php_setting($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 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, $zero_ok = false, $minusone_ok = false) {
$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 (($current == 0) && ($zero_ok)) {
$ret .= sprintf('unlimited (%s)', $current);
} else if (($current == -1) && ($minusone_ok)) {
$ret .= sprintf('unlimited (%s)', $current);
} else {
if ($bytes === true) {
$ret .= sprintf('%s', prettySize($current));
} else {
$ret .= sprintf('%s', $current);
}
}
$ret .= " |
\n";
return $ret;
}
function haveExtension($ext) {
if (extension_loaded($ext)) {
return true;
}
// According to PEAR.php:
// if either returns true dl() will produce a FATAL error, stop that
if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
return false;
}
$libfileext = '.so';
$libraryprefix = '';
if (substr(PHP_OS, 0, 3) == "WIN") {
$libfileext = '.dll';
$libraryprefix = 'php_';
}
@dl(sprintf("%s%s%s", $libraryprefix, $ext, $libfileext));
return extension_loaded($ext);
}
function must_extension_loaded($ext, $message = "") {
if (haveExtension($ext)) {
return 'Available';
}
if ($message) {
return 'Unavailable (' . $message . ')';
}
return 'Unavailable';
}
function can_extension_loaded($ext, $message = "") {
if (haveExtension($ext)) {
return 'Available';
}
if ($message) {
return 'Unavailable (' . $message . ')';
}
return 'Unavailable';
}
$phpversion = phpversion();
//$phpversion = '5.1'; // for debug
$phpversion5 = version_compare($phpversion, '5.0.0', '>=');
$phpversion522 = version_compare($phpversion, '5.2.2', '>=');
$phpversion6 = version_compare($phpversion, '6.0.0', '<');
if($phpversion5 == 1){
$phpversion5text = 'Yes';
} else {
$phpversion5text = 'No (You have PHP version '. $phpversion .' - '.APP_NAME.' does not work with versions less than PHP5 anymore)';
}
if($phpversion522 == 1){
$phpversion522text = 'Yes';
} else {
$phpversion522text = 'No (You have PHP version '. $phpversion .' - PHP 5.2.2 or above is recommended)';
}
if($phpversion6 == 1){
$phpversion6text = 'Yes';
} else {
$phpversion6text = 'No (You have PHP version '. $phpversion .' - '.APP_NAME.' does not work with versions greater than PHP5 yet)';
}
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.
';
}
?>
Checkup
Checkup
This checkup allows you to check that your environment is ready to
support a 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 manage the PHP settings that apply to the
application (it won't affect your other applications) by
configuring your web server to use the .htaccess files that come with
. This will ensure that the settings for
(detailed below) are set up for optimal, reliable performance.
General KnowledgeTree
| KnowledgeTree Server Directory
| |
| KnowledgeTree URL
| |
PHP version and extensions
This relates to your PHP installation environment - which version of
PHP you are running, and which modules are available.
'Session',
'mysql'=>'MySQL',
'mbstring'=>'Multi Byte String',
'curl'=>'cURL',
'exif'=>'Exif',
'sockets'=>'Sockets',
);
$optional_extensions = array(
'gettext'=>array('Gettext','Only needed for using non-English languages'),
'fileinfo'=>array('Fileinfo','Provides better file identification support - not necessary if you use file extensions'),
'win32service'=>array('Win32 Service','Allows Microsoft Windows services to be controlled. '),
'openssl'=>array('OpenSSL','Provides encryption support')
);
?>
| PHP version 5 or above |
|
| PHP version 5.2.2 or above |
|
| PHP version below 6 |
|
$name)
{
?>
| support |
|
$detail)
{
list($name, $desc) = $detail;
?>
| support |
|
PHP configuration
This relates to the configuration of PHP on your system.
Recommended settings
| Configuration option |
Recommended value |
Current value |
Limits
| Configuration option |
Recommended value |
Current value |
Paths
|
Session save path
|
,
Writeable' : 'Unwriteable';?>
|
|
Upload temporary path
|
Writeable' : 'Unwriteable';} ?>
|
Filesystem
log and Documents directories.";
} else {
$message = APP_NAME.' will be run as the ' . $username . ' system user, and must be able to write to the log and Documents directories.';
}
?>
| General |
|
Post-installation checkup
Once you have installed, check the Post-installation checkup.