Does anyone have an example of how to disable PHP Safe Mode for a specific directory? My PHP is configured as an Apache module.

Thank you

you can use .htaccess

just put a .htaccess file in that dir then the content of the .htaccess file should be:

php_value safe_mode "1"

search for .htaccess on this page: http://ca3.php.net/manual/en/function.ini-set.php for more help :)

or on the php.ini file which you upload to the directory enter this command:

safe_mode = Off

or on the php.ini file which you upload to the directory enter this command:

safe_mode = Off

:) You bumped into a 2 year old dead thread.

it is an old thread, but it is quite active in google, I was searching the web for " disabling safe mode for a directory " and this post is the first in google, and I think the solution given by Gary King:
php_value safe_mode "1"
is wrong, I think that probably will enable and not disable safe mode, that is why I've added my two pence.

:) ah! ok.

I tried everything mentionned above to disable the safe_mode of PHP but it still appears On for my local directory in which I execute phpinfo()

My settings:
PHP version:5.1.6
OS: Linux Cent OS
Apache 2.0

What I did:
in the php.ini:

safe_mode=Off

in the .htaccess of my local directory

php_flag safe_mode off

in the httpd.conf

<Directory " /var/www/vhosts/mydomain/httpdocs/mylocaldirectory">
php_admin_flag safe_mode off 
</Directory>

What i see in phpinfo:
Directive---------Local Value---------------------------------------------Master Value
safe_mode------On-------------------------------------------------------Off
open_basedir---/var/www/vhosts/mydomain/httpdocs:/tmp----no value

I would also like to clear the local value of open_basedir
i have set already set in my php.ini :

open_basedir=

Anyone found a solution to this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.