Unable to open file
I ins开发者_C百科talled php manual and tried to open it, but:
Warning: fopen(e.txt) [function.fopen]: failed to open stream: Permission denied in
Are you opening this in PHP? Is it on a server? If so you need to set the permissions of the folder it is in to allow reading the file. If it's just in a folder on your computer, is it then protected by any restrictions in the folder settings?
As Joshua 'Cuppers' Whittle answer the problem is most likely with your CHMOD permissions. However, I will post my answer in the more PHP and "dynamic" form.
Before opening the file:
if (substr(sprintf('%o', fileperms('e.txt')), -4) == 1777) {
chmod('e.txt', 777)
}
// And now the fopen(); part of your code
(Sadly, I cant test it myself, so this answer is theoretical only.)
精彩评论