![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jun 2003
Location: England
Posts: 1,063
|
Any PHP experts??
Is it correct that PHP can only delete files or folders owned by apache (or created using php)? If that is correct, is there a way around it?
I want a script Im writing to auto delete some files that were uploaded by ftp. I tried getting php to chmod the files to 777 but it wont do that even?
__________________
Free Site Express GFY Launch Offer Gay Demo Video - Straight Demo Video Icq: 191127710 Email: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Aug 2006
Location: Online (duh)
Posts: 167
|
__________________
HeatSeek: The iTunes of Porn ! $30 PPS, conversion ratios 10x better than content sites. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Rock 'n Roll Baby!
Join Date: Sep 2004
Location: USA, temporarly
Posts: 22,562
|
yes it is correct. File with 7 for everybody should be read, modified and deleted by nobody (apache) without problems.
__________________
Sig for sale. Affordable prices. Contact me and get a great deal ;) My contact: ICQ: 944-320-46 e-mail: manca {AT} HotFreeSex4All.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Jan 2005
Posts: 1,558
|
can you give us a little more details and I'm sure there is a solution.
Why are you using a php script to do this that is being run by user apache?
__________________
Useful adult webmaster links - Alphabetical list of solo models with webcam Stats on my best converting affiliate programs - camgirlshide webmaster blog complete list of affiliate programs I use. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Jun 2003
Location: England
Posts: 1,063
|
Its a cms of sorts, and Im uploading the big pics, then php crops the thumbs and copies the thumbs and the bigger photos to where they are meant to be. So apache is taking ownership of those files. Im wanting to then delete the source files.
Ive actually managaged to get the files deleted, now its not deleting the folder and is saying operation not permitted. Ill work on it some more today, Its something im doing wrong in my code ![]() Thanks for your help!
__________________
Free Site Express GFY Launch Offer Gay Demo Video - Straight Demo Video Icq: 191127710 Email: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Jun 2003
Location: England
Posts: 1,063
|
Actually I havent managed to delete the files either. It worked as I set permissions on that folder in ftp.
The issue is that it wont let me chmod files that apache doesnt own with php.
__________________
Free Site Express GFY Launch Offer Gay Demo Video - Straight Demo Video Icq: 191127710 Email: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Nov 2005
Posts: 2,167
|
You can't do anything apache can't.
You can't delete files if they are not owned by apache and dir permissions are not set properly. If you want to delete files/folders, apache has to be the owner corresponding file and directory. This all doesn't have anything to do with php per se, but how your server is setup. You'll have to read up on unix permissions to see what you can and can't do. You can't delete the folder again, if the upper folder doesn't give you permissions to do so, or you're not the owner of the folder. Then there's various other security settings that might be preventing you to do things that normally you could. Ask your host for help since you don't know it. To actually delete and do whatever the fuck you want, you'd need to suid yourself in php environment. This is ofcourse a big big no no and if you actually chose this route, you can expect to have alot bigger problems on your hands. Rather work with host and figure out what/where you want to modify with apache perms and set permissions accordingly.
__________________
agentGFY *at* gmail.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: May 2008
Location: Charlotte, NC
Posts: 342
|
This isn't a PHP limitation, but rather a *nix "limitation" - and with good reason. A user that doesn't have permissions to delete a file shouldn't be allowed to delete that file!
You could try creating a new FTP user that is a member of the same group as Apache, and only using that user to upload the images. You could also just change the permissions of your source files after you have uploaded them. Or you could look into the dangerous exec() and system() functions, which you could probably use to temporarily elevate permissions while you delete the files. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Jun 2003
Location: England
Posts: 1,063
|
What about chown() which php.net says will attempt to change ownership of the file. Is that considered dangerous to use?
Thanks for your help btw, I really apreciate the answers ![]()
__________________
Free Site Express GFY Launch Offer Gay Demo Video - Straight Demo Video Icq: 191127710 Email: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: May 2008
Location: Charlotte, NC
Posts: 342
|
This will still execute chown as the current user (apache). You should talk to your server administrator about the various options you have without compromising server security.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
Your issue is umask. It changes the ownership of the files that were chmod via php. You can try using the shell to chmod the files... when I started doing that it fixed my permissions issues.
PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |