ini_set and safe mode

hi all i am trying to enable safe mode so i can enable safe mode for a script i am developing but its not working correclty what i am doing wrong this is my code.

		if (ini_set('safe_mode','1'))
		   echo "<font color=red>SAFE_MODE ONline</font>";
		   echo "<font color=green>SAFE_MODE OFF still</font>";

What am i doing wrong?

Hello william232,

you simply can’t do it from inside of an php-script.
Why not? Because the ini_set command won’t work for “safe-mode” toggling, as safe_mode is a PHP_INI_SYSTEM (system wide setting) and can only be change via php.ini or .htaccess.

Look for “safe_mode” here:

So your alternatives are:
a) change the global safe_mode setting in php.ini
b) changing it per directory via .htacces (php_value safe_mode off/on)

regards, mr.vain

so for changing it on in the htaccess will enable it for that directory only?

No, because sub-directories also inherit permissions from parents unless they have a HTACCESS of their own.

I get.