sitesure Posted February 24, 2004 Share Posted February 24, 2004 I'm attempting to use unlink($file) without any results. Is that function disabled in our PHP configuration? Or, am I doing something wrong? I've passed both relative and absolute paths -- and verified (file_exists()) that the filename is correct... no luck. Any work-arounds? I'm trying to delete files based on user parameters (i.e., date/time). Thanks, Bill Quote Link to comment Share on other sites More sharing options...
DarqFlare Posted February 24, 2004 Share Posted February 24, 2004 Make sure to set the CHMOD of the PHP script correctly. Make sure to CHMOD the folder correctly. And the files, too. I've got a PHP script that uses unlink() and the function does work.... >unlink("../dir1/dir2/$Game_ID.$Ext"); is one modified snippet. CHMODS -- The PHP script executing it is 644, the folder the script is in is 755, the folder the file is in is 777 (I could tinker with this, but wont), and the file itself is in 644. Quote Link to comment Share on other sites More sharing options...
MikeJ Posted February 24, 2004 Share Posted February 24, 2004 Keep in mind that if you are running the PHP script as a webpage, it runs as user "nobody", not as you. So if the files it is trying to remove do not have world write permission set, they will fail. Quote Link to comment Share on other sites More sharing options...
sitesure Posted February 24, 2004 Author Share Posted February 24, 2004 Aaah! It was the folder -- adding public writable solved the problem. Strange, the script can upload files to that directory, thought unlink would work too. Thanks for the help. Quote Link to comment 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.