Search code examples
phpmacosapachemkdir

PHP mkdir not working -- may be related to Mac localhost


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


Solution

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