Check exactly where you are putting your files, don't nest them in the Documents folder.
For instance I made the mistake of putting my code in the Documents folder of as mentioned this isn't going to work because Documents is explicitly only available to YOU and not APACHE. Try moving it up one directory and you may not see this issue.
Move folder from:
/Users/YOURUSERNAME/Documents/code
To here:
/Users/YOURUSERNAME/code