sanfly Posted December 11, 2006 Share Posted December 11, 2006 Hi GuysIm trying to use unlink() to delete an image on my home computer server (WAMP5), but am getting the following error:[quote]Warning: unlink(images/users/) [function.unlink]: Permission denied in C:\server\www\NZSO\users.php on line 1218[/quote]Any ideas on what to do to get around this?Cheers Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/ Share on other sites More sharing options...
drifter Posted December 11, 2006 Share Posted December 11, 2006 well depending on your set up, if you create a file say with FTP, and one with a script, they will have different owners, so you will get this error if you delete the wrong file with the wrong method. Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-138815 Share on other sites More sharing options...
sanfly Posted December 11, 2006 Author Share Posted December 11, 2006 Well, the file is just an image that I uploaded using my upload script, I would assume if I could upload images I should be able to delete?Any further comments/suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-138819 Share on other sites More sharing options...
linuxdream Posted December 12, 2006 Share Posted December 12, 2006 Did you check the permisisons of the file like drifter said? If you uploaded and wrote the file using fwrite or something like that, it is probably owned by www-data or whatever your wed server's system user is (even if your upoad script was run by you). You would need to change either the owner/group and/or relax safe_mode to match GID and not UID. Creating and removing files through PHP is difficult to get right given the security/permission problems. Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139367 Share on other sites More sharing options...
ToonMariner Posted December 12, 2006 Share Posted December 12, 2006 check open base dir is not set in the php.ini file Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139370 Share on other sites More sharing options...
sanfly Posted December 12, 2006 Author Share Posted December 12, 2006 [quote]check open base dir is not set in the php.ini file[/quote]Its not set[quote]Did you check the permisisons of the file like drifter said? If you uploaded and wrote the file using fwrite or something like that, it is probably owned by www-data or whatever your wed server's system user is (even if your upoad script was run by you). You would need to change either the owner/group and/or relax safe_mode to match GID and not UID. Creating and removing files through PHP is difficult to get right given the security/permission problems.[/quote]How do I check the permissions? Im running WAMP5 (apache/mysql/php) on my home PC. I didnt use fwrite, basically just move_uploaded_file() Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139411 Share on other sites More sharing options...
linuxdream Posted December 12, 2006 Share Posted December 12, 2006 Windows....hmmm, not sure then. Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139474 Share on other sites More sharing options...
sanfly Posted December 12, 2006 Author Share Posted December 12, 2006 So does anyone else have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139997 Share on other sites More sharing options...
Caesar Posted December 12, 2006 Share Posted December 12, 2006 [quote author=sanfly link=topic=118146.msg483661#msg483661 date=1165966989]So does anyone else have any ideas?[/quote]Try a Linux-based server? :-P Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-139999 Share on other sites More sharing options...
sanfly Posted December 12, 2006 Author Share Posted December 12, 2006 Thanks ;D, but how about a suggestion for my current system. Must be possible, never had this problem on my old setup Quote Link to comment https://forums.phpfreaks.com/topic/30196-unlink-permission-denied/#findComment-140005 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.