954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Disabling PHP Safe Mode for a specific directory

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

sea
Newbie Poster
1 post since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

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 :)

Gary King
PHP/vBulletin Guru
Team Colleague
417 posts since Nov 2003
Reputation Points: 53
Solved Threads: 5
 

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

safe_mode = Off

visio
Newbie Poster
19 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

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.

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 

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.

visio
Newbie Poster
19 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

:) ah! ok.

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 

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=
franzinho
Newbie Poster
1 post since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

Anyone found a solution to this?

karmafunk
Newbie Poster
1 post since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You