/** * Checks various server settings prior to starting installation. Some end the installation; others * just return notices. * @return void */ public function checkServerSettings() { $allow_install = true; // Settings were checked, return without issue. if (isset($_SESSION['server_passed'])) { return; } $test['session_auto_start']['pass'] = !(bool) ini_get('session.auto_start'); // need 0 $test['session_auto_start']['fail'] = dgettext('core', 'session.auto_start must be set to 0 for phpWebSite to work. Please review your php.ini file.'); $test['session_auto_start']['name'] = dgettext('core', 'Session auto start disabled'); $test['session_auto_start']['crit'] = true; $test['pear_files']['pass'] = is_file('lib/pear/MDB2.php'); $test['pear_files']['fail'] = sprintf(dgettext('core', 'Could not find Pear library files. You will need to %sdownload the pear package from our site%s and unzip it in your installation directory.'), '<a href="http://phpwebsite.appstate.edu/downloads/pear.zip">', '</a>'); $test['pear_files']['name'] = dgettext('core', 'Pear library installed'); $test['pear_files']['crit'] = true; $test['gd']['pass'] = extension_loaded('gd'); $test['gd']['fail'] = sprintf(dgettext('core', 'You need to compile the %sGD image library%s into PHP.'), '<a href="http://www.libgd.org/Main_Page">', '</a>'); $test['gd']['name'] = dgettext('core', 'GD graphic libraries installed'); $test['gd']['crit'] = true; $test['image_dir']['pass'] = is_dir('images/') && is_writable('images/'); $test['image_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'images/'); $test['image_dir']['name'] = dgettext('core', 'Image directory ready'); $test['image_dir']['crit'] = true; $test['conf']['pass'] = is_dir('config/core/') && is_writable('config/core/'); $test['conf']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'config/core/'); $test['conf']['name'] = dgettext('core', 'Config directory ready'); $test['conf']['crit'] = true; $test['file_dir']['pass'] = is_dir('files/') && is_writable('files/'); $test['file_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'files/'); $test['file_dir']['name'] = dgettext('core', 'File directory ready'); $test['file_dir']['crit'] = true; $test['log_dir']['pass'] = is_dir('logs/') && is_writable('logs/'); $test['log_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'logs/'); $test['log_dir']['name'] = dgettext('core', 'Log directory ready'); $test['log_dir']['crit'] = true; $test['ffmpeg']['pass'] = is_file('/usr/bin/ffmpeg'); $test['ffmpeg']['fail'] = dgettext('core', 'You do not appear to have ffmpeg installed. File Cabinet will not be able to create thumbnail images from uploaded videos'); $test['ffmpeg']['name'] = dgettext('core', 'FFMPEG installed'); $test['ffmpeg']['crit'] = false; $test['mime_type']['pass'] = function_exists('finfo_open') || function_exists('mime_content_type') || !ini_get('safe_mode'); $test['mime_type']['fail'] = dgettext('core', 'Unable to detect MIME file type. You will need to compile finfo_open into PHP.'); $test['mime_type']['name'] = dgettext('core', 'MIME file type detection'); $test['mime_type']['crit'] = true; if (preg_match('/-/', PHP_VERSION)) { $phpversion = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '-')); } else { $phpversion = PHP_VERSION; } $test['php_version']['pass'] = version_compare($phpversion, '5.1.0', '>='); $test['php_version']['fail'] = sprintf(dgettext('core', 'Your server must run PHP version 5.1.0 or higher. You are running version %s.'), $phpversion); $test['php_version']['name'] = dgettext('core', 'PHP 5 version check'); $test['php_version']['crit'] = true; $memory_limit = (int) ini_get('memory_limit'); $test['memory']['pass'] = $memory_limit > 8; $test['memory']['fail'] = dgettext('core', 'Your PHP memory limit is less than 8MB. You may encounter problems with the script at this level.'); $test['memory']['fail'] .= dgettext('core', 'We suggest raising the limit in your php.ini file or uncommenting the "ini_set(\'memory_limit\', \'10M\');" line in your config/core/config.php file after installation.'); $test['memory']['name'] = dgettext('core', 'Memory limit exceeded'); $test['memory']['crit'] = false; $test['globals']['pass'] = !(bool) ini_get('register_globals'); $test['globals']['fail'] = dgettext('core', 'You have register_globals enabled. You should disable it.'); $test['globals']['name'] = dgettext('core', 'Register globals disabled'); $test['globals']['crit'] = false; $test['magic_quotes']['pass'] = !get_magic_quotes_gpc() && !get_magic_quotes_runtime(); $test['magic_quotes']['fail'] = dgettext('core', 'Magic quotes is enabled. Please disable it in your php.ini file.'); $test['magic_quotes']['name'] = dgettext('core', 'Magic quotes disabled'); $test['magic_quotes']['crit'] = true; foreach ($test as $test_section => $val) { if (!$val['pass']) { if ($val['crit']) { $crit[] = $val['fail']; $allow_install = false; } else { $warn[] = $val['fail']; } } } $content = array(); if (!$allow_install) { $this->title = dgettext('core', 'Cannot install phpWebSite because of the following reasons:'); $this->content = '<ul>' . PHPWS_Text::tag_implode('li', $crit) . '</ul>'; $this->display(); } else { $_SESSION['server_passed'] = true; } }