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 .