dongsonglian7303
2013-04-24 01:23
浏览 42
已采纳

在VPS上使用finfo

I've tested that this works locally, but now that I've moved my content to a godaddy VPS, I'm finding some problems.

I contacted support about it and they told me to research this.

What I have found is that this code:

   $finfo = new finfo(FILEINFO_MIME, "../../../../../etc/httpd/conf/magic");

Is pointing to the correct location, but according to support, the webuser does not have access.

What would be the safest way to go about this? I'm relatively new to server management.

EDIT: UPDATE

Only the php.ini file is contained in /etc, which makes /etc/httpd/conf/magic an invalid path for me to use. My local dev machine is Ubuntu Linux. Would I be able to chmod on-the-fly in my PHP code somehow? Thanks in advance.

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

我已经测试过它在本地运行,但是现在我已经将我的内容移到了一个godaddy VPS,我 我发现了一些问题。

我联系了有关它的支持,他们告诉我研究它。

我发现的是这段代码: <前> $ finfo = new finfo(FILEINFO_MIME,“../../../../../etc/httpd/conf/magic");

指向正确的位置,但根据支持,webuser无权访问。

最安全的方法是什么? 我对服务器管理比较陌生。

EDIT:UPDATE

只有php.ini文件包含在/ etc中,这使得/ etc / httpd / conf / magic是我使用的无效路径。 我的本地开发机器是Ubuntu Linux。 我能以某种方式在我的PHP代码中动态chmod吗? 提前致谢。

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

1条回答 默认 最新

  • dongyou7472 2013-04-24 12:51
    已采纳

    Try this:

    # chmod +r /etc/httpd/conf/magic
    

    This will give your users read permission.

    点赞 评论

相关推荐 更多相似问题