Added some checks around the configuration of PHP sessions since it seems to cause a lot of troubles.

SVN:trunk[2548]
This commit is contained in:
Denis Flaven
2012-12-07 10:33:26 +00:00
parent 55354389dc
commit a651105675

View File

@@ -297,6 +297,40 @@ class SetupUtils
}
$aResult[] = new CheckResult(CheckResult::INFO, "Loaded php.ini files: $sPhpIniFile");
}
// Check the configuration of the sessions persistence, since this is critical for the authentication
if (ini_get('session.save_handler') == 'files')
{
$sSavePath = ini_get('session.save_path');
// According to the PHP documentation, the format can be /path/where/to_save_sessions or "N;/path/where/to_save_sessions" or "N;MODE;/path/where/to_save_sessions"
$sSavePath = ltrim(rtrim($sSavePath, '"'), '"'); // remove surrounding quotes (if any)
if (!empty($sSavePath))
{
if (($iPos = strrpos($sSavePath, ';', 0)) !== false)
{
// The actual path is after the last semicolon
$sSavePath = substr($sSavePath, $iPos+1);
}
if (!is_writable($sSavePath))
{
$aResult[] = new CheckResult(CheckResult::ERROR, "The value for session.save_path ($sSavePath) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
}
else
{
$aResult[] = new CheckResult(CheckResult::INFO, "The value for session.save_path ($sSavePath) is writable for the web server.");
}
}
else
{
$aResult[] = new CheckResult(CheckResult::WARNING, "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
}
}
else
{
$aResult[] = new CheckResult(CheckResult::INFO, "session.save_handler is: '".ini_get('session.save_handler')."' (different from 'files').");
}
return $aResult;
}