Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Unlink Fails To Delete File

  • Please log in to reply
No replies to this topic

#1 Guest_hollowface_*


  • Guests

Posted 14 August 2016 - 07:41 PM

While working on a new feature for BFMS (a project of mine) I got stuck for quite some time on an unlink issue in PHP. I needed unlink to delete some files, but it kept failing to do so. The path looked correct when I echoed it. When checking with php the file would not be listed as writable, despite being writable when I checked with my file-manager.

The problem turned out to be a line endings in the path name. I was creating the path using information imported from a file using the file command. Once I added FILE_IGNORE_NEW_LINES to the file command unlink worked without a hitch :). Basically, instead of trying to delete


I was trying to delete


which is why I was running into issues.

Just thought I'd share this in case anyone else runs into the same issue with unlink. Happy coding :).

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users