GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP renaming folder problem (https://gfy.com/showthread.php?t=794309)

jOE :D 12-23-2007 02:12 AM

PHP renaming folder problem
 
I'm trying to rename a folder from a php file and it's giving me an error. I'm getting a 'Permission Denied' error, but the folder chmod is 777 so I don't understand why I'm getting this error.

teksonline 12-23-2007 02:39 AM

is it outside of the script parent directory?

dissipate 12-23-2007 02:41 AM

the script doesnt have permissions for the folder, you'll have to chown it to a different owner with the correct delete privileges.

jOE :D 12-23-2007 02:41 AM

Quote:

Originally Posted by teksonline (Post 13554117)
is it outside of the script parent directory?

Yes the script is in '/includes/cron' and the folder name I want to change is just in /. I'm using full paths to the folders though.

dissipate 12-23-2007 02:43 AM

It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.

jOE :D 12-23-2007 02:45 AM

Quote:

Originally Posted by dissipate (Post 13554125)
It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.

I understand file permissions. The permissions to the folder are 777 so others should be able to execute stuff on the folder.

teksonline 12-23-2007 02:45 AM

are you in safe mode?

dissipate 12-23-2007 02:49 AM

Quote:

Originally Posted by jOE :D (Post 13554126)
I understand file permissions. The permissions to the folder are 777 so others should be able to execute stuff on the folder.

Yes, but there is also an OWNER of the file/folder, you fucking boob. There is a different between chroot and chown. If it's in /includes/cron then it is is most likely owned by the root user. A simple 'ls -l' will show the owner. And your script isnt being executed by the root user unless you're executing it from the command line.

jOE :D 12-23-2007 02:52 AM

Quote:

Originally Posted by dissipate (Post 13554134)
Yes, but there is also an OWNER of the file/folder, you fucking boob. There is a different between chroot and chown. If it's in /includes/cron then it is is most likely owned by the root user. A simple 'ls -l' will show the owner. And your script isnt being executed by the root user unless you're executing it from the command line.

Well then how do I get around that so I can have it executed from the web?

dissipate 12-23-2007 03:00 AM

Quote:

Originally Posted by jOE :D (Post 13554139)
Well then how do I get around that so I can have it executed from the web?

http://www.php.net
http://www.google.com

The interwebz is for porn.

jOE :D 12-23-2007 03:02 AM

Quote:

Originally Posted by dissipate (Post 13554149)
http://www.php.net
http://www.google.com

The interwebz is for porn.

Thanks, I didn't think of those sites before I wasted time posting on a forum. Who would have thought those sites would have helped?

dissipate 12-23-2007 03:08 AM

Quote:

Originally Posted by jOE :D (Post 13554152)
Thanks, I didn't think of those sites before I wasted time posting on a forum. Who would have thought those sites would have helped?

Well now that you know what your problem is, maybe they will help. Merry XMAS.

teksonline 12-23-2007 03:09 AM

Who cares who owns it, when its 777 its world writable
the problem is php security can not write outside its root in safe mode

dissipate 12-23-2007 03:12 AM

Quote:

Originally Posted by teksonline (Post 13554163)
Who cares who owns it, when its 777 its world writable
the problem is php security can not write outside its root in safe mode


When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. So yes, the owner of the file matters.

jOE :D 12-23-2007 03:36 AM

Quote:

Originally Posted by dissipate (Post 13554168)
When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. So yes, the owner of the file matters.

Safe mode is off for this domain

teksonline 12-23-2007 03:38 AM

su_exec? come on man, fill us in on required details and then the answer will present itself

k0nr4d 12-23-2007 04:37 AM

check for openbasedir restrictions? the user that owns it wouldn't matter, as if its chmodded to 0777 it's world writable anyways.

How are you trying to rename it? exec('mv source target') or what?

teksonline 12-23-2007 04:41 AM

I imagine he is unsing rename()
maybe he can't rename it because he is in it? :)

Damian_Maxcash 12-23-2007 04:48 AM

I had a similar problem and it was my dumb host.... change it to 755 and try it.

It worked for me and they said it was some security shit that wouldnt let 777 work.

etcohen 12-23-2007 05:48 PM

you can try set file privilege for web..

chown www 'filename'

Iron Fist 12-23-2007 05:49 PM

Quote:

Originally Posted by dissipate (Post 13554125)
It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.

:2 cents: Yikes.

teksonline 12-23-2007 05:49 PM

Quote:

Originally Posted by Damian_Maxcash (Post 13554354)
I had a similar problem and it was my dumb host.... change it to 755 and try it.

It worked for me and they said it was some security shit that wouldnt let 777 work.

Uhm, could be some sort of suexec thing which i asked about above, but don't sound right. i could see an error trying to access contents, but not rename..

He isnt providing system info, so no sense wasting brains over this one...


All times are GMT -7. The time now is 03:46 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123