condoug;11032289 wrote:Hi all
I have a PHP script that creates a customer folder on the server when a purchase is completed. This folder is stored within a folder I have manually created via FTP on the server called ORDERS. The owner/group of that ORDERS folder is 2723/1043
And presumably that's the UID and GID for the FTP account you refer to below?
Now, the folders which are created inside this folder for each customer, the owner/group is 80/80
Which is the HTTP server's UID/GID
however when I log into the server via FTP using the admin account details, I cannot write files to those folders (which is the main purpose of these folder existing) and I get permission denied errors. The Permission settings are CHMOD 755 according to my FTP client.
Which is strange IF your call to [man]mkdir/man is working as you seem to expect ...
Even if I manually change this to be 777, I still cannot move files into the customer folders.
Are you quite certain that the manual change to the file permissions is working?
What am I doing wrong when I create these folders via PHP. Here is my code:
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/orders/$folder")) {
mkdir($_SERVER['DOCUMENT_ROOT'] . "/orders/$folder", 0777, true);
}
Thank you for any advice
Well, let me preface this by saying I have NO IDEA off the top of my head why this isn't working.
But try this?
mkdir($_SERVER['DOCUMENT_ROOT'] . "/orders/$folder", 0777, true);
chmod($_SERVER['DOCUMENT_ROOT'] . "/orders/$folder", 0777);
That works for me, here, setting the folder permissions to 'rwxrwxrwx'.