function check($tikidomain = '') { static $checked; if ($checked) { return; } $checked = true; $errors = ''; if (strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') == TRUE) { if (array_key_exists('PATH_TRANSLATED', $_SERVER)) { $docroot = dirname($_SERVER['PATH_TRANSLATED']); } else { $docroot = getcwd(); } } else { $docroot = getcwd(); } if (ini_get('session.save_handler') == 'files') { $save_path = ini_get('session.save_path'); // check if we can check it. The session.save_path can be outside // the open_basedir paths. $open_basedir = ini_get('open_basedir'); if (empty($open_basedir)) { if (!is_dir($save_path)) { $errors .= "The directory '{$save_path}' does not exist or PHP is not allowed to access it (check open_basedir entry in php.ini).\n"; } else { if (!is_writeable($save_path)) { $errors .= "The directory '{$save_path}' is not writeable.\n"; } } } if ($errors) { $save_path = TikiSetup::tempdir(); if (is_dir($save_path) && is_writeable($save_path)) { session_save_path($save_path); $errors = ''; } } } $wwwuser = ''; $wwwgroup = ''; if (TikiSetup::isWindows()) { $wwwuser = '******'; $wwwgroup = 'SYSTEM'; } if (function_exists('posix_getuid')) { $user = @posix_getpwuid(@posix_getuid()); $group = @posix_getpwuid(@posix_getgid()); $wwwuser = $user ? $user['name'] : false; $wwwgroup = $group ? $group['name'] : false; } if (!$wwwuser) { $wwwuser = '******'; } if (!$wwwgroup) { $wwwgroup = 'nobody (or the group account the web server is running under)'; } static $dirs = array('backups', 'dump', 'img/wiki', 'img/wiki_up', 'modules/cache', 'temp', 'templates_c'); foreach ($dirs as $dir) { if (!is_dir("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' does not exist.\n"; } else { if (!is_writeable("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' is not writeable by {$wwwuser}.\n"; } } } if ($errors) { $PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH; ob_start(); phpinfo(INFO_MODULES); $httpd_conf = 'httpd.conf'; if (preg_match('/Server Root<\\/b><\\/td><td\\s+align="left">([^<]*)</', ob_get_contents(), $m)) { $httpd_conf = $m[1] . '/' . $httpd_conf; } ob_end_clean(); print "\n<html><body>\n<h2><font color='red'>Tikiwiki is not properly set up:</font></h1>\n<pre>\n{$errors}\n"; if ($tikidomain) { $install_link = '?multi=' . urlencode($tikidomain); } if (!TikiSetup::isWindows()) { print "Your options:\n\n\n\t1- With FTP access:\n\t\ta) Change the permissions (chmod) of the directories to 777.\n\t\tb) Create any missing directories\n\t\tc) <a href='tiki-install.php{$install_link}'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\n\tor\n\n\t2- With shell (SSH) access, you can run the command below.\n\n\t\ta) Run setup.sh and follow the instructions:\n\t\t\t\$ bash\n\t\t\t\$ cd {$docroot}\n\t\t\t\$ sh setup.sh\n\n\t\tThe script will offer you options depending on your server configuration.\n\n\t\tb) <a href='tiki-install.php{$install_link}'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\n\n<hr>\nIf you have problems accessing a directory, check the open_basedir entry in\n{$PHP_CONFIG_FILE_PATH}/php.ini or {$httpd_conf}.\n\n<hr>\n\n<a href='http://doc.tikiwiki.org/Installation' target='_blank'>Consult the tikiwiki.org installation guide</a> if you need more help or <a href='http://tikiwiki.org/tiki-forums.php' target='_blank'>visit the forums</a>\n\n</pre></body></html>"; } exit; } }
function check($tikidomain = '') { static $checked; if ($checked) { return; } $checked = true; $errors = ''; if (strpos($_SERVER["SERVER_SOFTWARE"], "IIS") == TRUE) { if (array_key_exists('PATH_TRANSLATED', $_SERVER)) { $docroot = dirname($_SERVER['PATH_TRANSLATED']); } else { $docroot = getcwd(); } } else { $docroot = getcwd(); } if (ini_get('session.save_handler') == 'files') { $save_path = ini_get('session.save_path'); // check if we can check it. The session.save_path can be outside // the open_basedir paths. $open_basedir = ini_get('open_basedir'); if (empty($open_basedir)) { if (!is_dir($save_path)) { $errors .= "The directory '{$save_path}' does not exist or PHP is not allowed to access it (check open_basedir entry in php.ini).\n"; } else { if (!is_writeable($save_path)) { $errors .= "The directory '{$save_path}' is not writeable.\n"; } } } if ($errors) { $save_path = TikiSetup::tempdir(); if (is_dir($save_path) && is_writeable($save_path)) { ini_set('session.save_path', $save_path); $errors = ''; } } } $wwwuser = ''; $wwwgroup = ''; if (TikiSetup::isWindows()) { $wwwuser = '******'; $wwwgroup = 'SYSTEM'; } if (function_exists('posix_getuid')) { $user = @posix_getpwuid(@posix_getuid()); $group = @posix_getpwuid(@posix_getgid()); $wwwuser = $user ? $user['name'] : false; $wwwgroup = $group ? $group['name'] : false; } if (!$wwwuser) { $wwwuser = '******'; } if (!$wwwgroup) { $wwwgroup = 'nobody (or the group account the web server is running under)'; } static $dirs = array('backups', 'dump', 'img/wiki', 'img/wiki_up', 'modules/cache', 'temp', 'templates_c'); foreach ($dirs as $dir) { if (!is_dir("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' does not exist.\n"; } else { if (!is_writeable("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' is not writeable by {$wwwuser}.\n"; } } } if ($errors) { $PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH; ob_start(); phpinfo(INFO_MODULES); $httpd_conf = 'httpd.conf'; if (preg_match('/Server Root<\\/b><\\/td><td\\s+align="left">([^<]*)</', ob_get_contents(), $m)) { $httpd_conf = $m[1] . '/' . $httpd_conf; } ob_end_clean(); print "\n<html><body>\n<h2><font color='red'>TikiWiki is not properly set up:</font></h1>\n<pre>\n{$errors}\n"; if ($tikidomain) { $install_link = '?multi=' . urlencode($tikidomain); } if (!TikiSetup::isWindows()) { print "You may either chmod the directories above manually to 777, or run one of the sets of commands below.\n<b><a href='tiki-install.php{$install_link}'>Proceed to the Tiki installer</a></b> after you run the commands below.\n\nIf you cannot become root, and are NOT part of the group {$wwwgroup}:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ ./setup.sh yourlogin yourgroup 02777\n Tip: You can find your group using the command 'id'.\n\nIf you cannot become root, but are a member of the group {$wwwgroup}:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ ./setup.sh mylogin {$wwwgroup}</i>\n\nIf you can become root:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ su -c './setup.sh {$wwwuser}'\n\nIf you have problems accessing a directory, check the open_basedir entry in\n{$PHP_CONFIG_FILE_PATH}/php.ini or {$httpd_conf}.\n\nOnce you have executed these commands, this message will disappear!\n\nNote: If you cannot become root, you will not be able to delete certain\nfiles created by apache, and will need to ask your system administrator\nto delete them for you if needed.\n\n<a href='http://tikiwiki.org/InstallTiki' target='_blank'>Consult the tikiwiki.org installation guide</a> if you need more help.\n\n<b><a href='tiki-install.php'>Proceed to the Tiki installer</a></b> if you've completed the steps above.\n</pre></body></html>"; } exit; } }