The following function will return TRUE if the server is running PHP in safe mode. It uses the function ini_get, which may be disabled. If ini_get is disabled then the function also returns TRUE since the assumption that any server disabling functions would probably also be running in safe mode.
function is_safe_mode()
/* Returns true if PHP is in safe_mode. Defaults to 'true' because
this will use ini_get which may be disabled. If ini_get is disabled
then we are probably in safe_mode */
{
$retval = true;
if (function_exists('ini_get'))
{
if (ini_get('safe_mode')==true)
{
$retval = true;
}
else
{
$retval = false;
}
}
else
{
$retval = true;
}
return $retval;
}
Be First to Comment