Improvements to safe_mode detection (it doesn't exist in PHP 5.4)