...

View Full Version : Safe_mode Restriction



Badman3k
10-12-2004, 04:36 PM
I'm trying to use PHP to create a folder. I'm using the code
mkdir("../img/",0777);but every time I try and run the script I get the error message:
SAFE_MODE RESTRICTIONS

Now I've tried several things, like using chmod on the php file that's trying to run the prog.

Does anyone have any idea on what I can do?

Many thanks in advance,

ReadMe.txt
10-12-2004, 08:43 PM
safe mode is an option set by your host to make php 'safer' in this case it appears to be blocking the chance to make new directories.

Badman3k
10-13-2004, 01:16 PM
I thought that this may be the case, but is there any way to 'disable' it temporarily by using ini_set or another method? I've been trying locally to change the value but can't seem to do it, even editing the php.ini file in notepad doesn't switch it on or off!

Many thanks for replying.

Many thanks in advance,

Darknight
10-13-2004, 03:15 PM
2 things that could be at work here
1) you want to 'fix' your host ie edit the safe mode setting (can't do btw)
2) your running a local webserver with php installed and want to get that fixed.

If you are running the webserver and have access to php.ini as you stated look for:

; Safe Mode
;
safe_mode = Off

Around line 156

Understand though, your host (if your using one) will not allow you to edit the php.ini. You might contact them to find out if there is a different way to get the dirs made, who knows they might have a workaround for you.

Badman3k
10-14-2004, 09:08 AM
Thanks for your replies, I've emailed my host to ask if there's a workaround for it.

Many thanks again,

AaronW
10-14-2004, 03:01 PM
Try using 0755 for the chmod param instead. PHP won't create 0777 directories, in my experience.

looka
06-06-2006, 10:27 AM
well, safe_mode is one very nasty restriction...
on every object created(a dir, for instance), the user is set to someelse than owner of your script. (usually user = 'no-one' or something similar)

so, you can not access this dir.

option is that you choose cgi-script or ftp access.

Badman3k
06-06-2006, 10:32 AM
Thanks for the response. I decided to do both ftp and the standard php script i started with, but testing to see whether safe_mode is on or not before doing the appropriate method. Thanks for the reply though.

looka
06-12-2006, 11:56 AM
that was my response to safe_mode too:)

Digger3000
06-12-2006, 01:41 PM
That's why I have a local webserver. Although I'm not sure what 0777 is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum