Ok all my files and folders are set as owner of vsftpd:nogroup. FTP program can upload and create and do everything. But when I use the PHP command mkdir, I get a Permission Denied even though the folder its creating it in is set to chmod 777. IF i set the base folder to user www-data and group www-data, PHP mkdir will work. However, I can't use FTP to delete or upload to that folder.
Well I'm not that good with PHP, if I can't figure something out I just google until I find what I'm looking for. My PHP code is kind of spaghetti code, but it does the job.. If I were you I would post to a dedicated PHP message forum and someone there would be able to help you out...
little rusty on this. I did write a script at one time that creates a directory and then creates directories and files in that directory. www-data does have to have read/write permissions in order for php to make the directory.
It looks to me like your php is correct although I'm not sure about the 0777 part. I think I just used 777. I was always a little confused about the leading 0 since the 777 are for read/write/delete.
It's confusing though because ftp access is a separate issue from your php script. I'm wondering about two things. Could it be a setting in your ftp server? And where you say www-data:www-data you mean the owner is www-data and the group is www-data as in when you view permissions in a terminal right?
Maybe check some of the other directories on the server and see what the owner and group are set to. Because I don't think the owner and group both have to be set to www-data in order to give read/write access to www-data.
I'll have to get to my Linux server in the morning. On a windows PC right now which obviously doesn't do any good.