开发者

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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜