PHP的mkdir不工作 - 可能与本地主机的Mac [英] PHP mkdir not working -- may be related to Mac localhost

查看:177
本文介绍了PHP的mkdir不工作 - 可能与本地主机的Mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的PHP脚本执行下列code:

I'm trying to execute the following code in my PHP script:

if (!is_dir($path . 'channel-partners/html/intro-letter/' . $name_url)) {
      mkdir($path . 'channel-partners/html/intro-letter/' . $name_url, 0777, true);
}

$ name_url 在运行时传入的字符串。我得到许可,当我尝试做这在我的Mac本地主机。我想知道如果这个问题不是我的剧本,但Apache是​​建立在我的Mac的方式。我需要做一些特别配置Apache,使其能够创建文件和目录做(文件创建这里没有显示)?

$name_url is a string passed in at runtime. I get permission when I try to do this in my Mac localhost. I'm wondering if the issue is not my script but the way Apache is set up on my Mac. Do I need to do something special to configure Apache to allow it to create files and make directories (the file creation is not shown here)?

推荐答案

您也许应该设置apache用户适当的权限,以你的目标文件夹。

You should probably set the appropriate rights for the apache user to your destination folder.

这篇关于PHP的mkdir不工作 - 可能与本地主机的Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆