【问题标题】:Permission denied when saving a file to xampp htdocs directory将文件保存到 xampp htdocs 目录时权限被拒绝
【发布时间】:2018-12-10 21:23:36
【问题描述】:

您好,我有一个问题,我正在尝试将文件保存到 htdocs 上的目录,它说权限被拒绝。

  <?php


$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
file_put_contents('./images/myFile.gif', $image);

【问题讨论】:

  • 请原谅,但该错误的哪一部分不清楚?您的 Web 服务器用户无权写入该目录。
  • 你的操作系统是什么?
  • 我只使用 localhost 或我自己的 ser,我正在将文件从 Internet 保存到我在 htdocs 上的文件夹中。如何授予权限。
  • mac os high siera
  • 可能你没有权限。

标签: php mysql htdocs


【解决方案1】:

您必须允许将图像插入到 htdocs 中的特定文件夹中 举个例子 在ubuntu中

sudo chmod 644 /opt/lampp/hdocs/yourfolder

同样,您必须授予访问该特定文件夹的权限

【讨论】:

  • @Jan Genvher Papica 对您的帮助是否充分?
  • 试过sudo chmod 755 /path,但也没有用。
  • 我也尝试将所有者更改为www-data,但未能解决问题。
  • 请进一步解释
  • 是的,将ownergroup 更改为我的laptpop_userName 对我有用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-05-18
  • 2012-01-05
  • 2017-03-15
  • 1970-01-01
  • 2019-07-22
  • 1970-01-01
  • 2017-05-14
相关资源
最近更新 更多