duanhemou9834
2016-11-19 11:01
浏览 644
已采纳

fopen()权限被拒绝

I have an issue that I cannot create any files using fopen.

I am using this as a test:

<?php
$myfile = fopen("testfile.txt", "w")
?>

and this error is output in NewRelic (and no testfile.txt is not created):

fopen(testfile.txt): failed to open stream: Permission denied

图片转代码服务由CSDN问答提供 功能建议

我遇到一个问题,我无法使用fopen创建任何文件。

我使用它作为测试:

 &lt;?php 
 $ myfile = fopen(“testfile.txt”,“w”)
?&gt; 
    
 
 

此错误在NewRelic中输出(并且未创建testfile.txt):

fopen (testfile.txt):无法打开流:权限被拒绝

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doudaotui4297 2016-11-19 11:06
    已采纳

    It's because you don't have the right to open it. Make sure you have the right to write. If on linux you can use chmod() to set the the right of the file.

    点赞 评论

相关推荐 更多相似问题