Page 1 of 1

Create files & folders safe mode ON

Posted: Sun Sep 28, 2008 1:44 pm
by oleg
I have a server with safe mode on, I create folders via FTP and copy files with fwrite, so far it is a little mess but is working, if some one knows a class that can make it more simple I apreciate.

My problem is that if I want to copy files the folder must have chmod at 777. I try to change the chmod at the beggining and at the end of the copy, but I dont have the rigths to do it.

This is my first problem, my second is that once I create the file, this must require other file, the typical require_once sentence but I get this error

Warning: require_once() [function.require-once]: SAFE MODE Restriction in effect. The script whose uid is 48 is not allowed to access

This require has the data base configuration, therefore I put it out of the folder with 777 permissions.

Does anyone know a way to avoid or solve this problems?
I cant change the safe_mode because is not a private server.

Thanks in advance.

Re: Create files & folders safe mode ON

Posted: Sun Sep 28, 2008 1:56 pm
by VladSun
Try to add this line to the .htaccess file in your directory:

Code: Select all

php_admin_value safe_mode Off
About chmod ... only the owner and the super user (root) can change file permissions.

Re: Create files & folders safe mode ON

Posted: Mon Sep 29, 2008 11:45 am
by oleg
I cant change the safe mode via .htaccess, it give me a missconfiguration error.

The thing is that the user that created the folders is the owner and is the same user that Im using to change the permissions.

Re: Create files & folders safe mode ON

Posted: Mon Sep 29, 2008 1:34 pm
by alex.barylski
The only work around is to use FTP programmatically from PHP. Find a FTP class and goto town.

This is required because FTP runs under a different user than PHP/Apache. PITA I know.