PHP – how to check if safe mode is on / off on your hosting server account

300px-PHP-logo.svgThere are some scripts and codes that specifically need safe mode to be turn on or off depending upon their requirement.

I had a similar issue with my hosting server account, i asked the server people and they mentioned that the safe mode settings are already as to what i want it to be. Well! i was confused! so i showed them the result via a script that the safe mode is not upto what i want it to be.

So if anyone of you wants to check themself or wanna prove/show some one that the safe mode is on or off on their hosting server account, simply create a new php file in their hosting account directory and add this code to it, save the file and run it from the browser:


// Check for safe mode
if( ini_get(‘safe_mode’) ){
echo “Safe mode is on”;
echo “Safe mode is off”;


Hopefully it solves the issue.

Leave a Reply

Your email address will not be published.