There are several similar questions on here, such as this one, but the answer to that question (and several others I read) is:
let PHP create the directory itself in the first place.
I use git
on my site, so it's not possible to allow PHP to "create the directory itself."
To pull in changes, I run a git pull origin master
command when logged into my server via SSH, which makes the owner of the files my cpanel user I'm logged in as.
I need PHP to be able to create files in certain directories. Is the only way to allow this to chmod
the folders to 777
, or is there a better way?
I don't have a good understanding of Linux permissions, but from what I've read changing directory and file permissions to 777
is generally not a good idea. Furthermore, if I chmod
the folders to 777
, I suspect the permissions will be overwritten when I run git pull origin master
, although I haven't tested this.