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.
If /uploads is vsftpd:nogroup then PHP mkdir will give a Permission Denied error.
If /uploads is www-data:www-data then PHP mkdir WILL work, but I cant continue to FTP anything in that folder that was just created.
If /uploads is vsftpd:www-data then PHP mkdir will give a Permission Denied error.
The username I use to FTP into the server is piagency.
The username for this vhost is clients.thepiagency.com
How can I create a directory with PHP and still be able to access it via FTP?
If I have to assign people to multiple groups, how do i do that exactly? I started messing with usermod but I was afraid I would reassign someone incorrectly.
08-26-2011, 10:49 AM
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...
08-28-2011, 10:52 PM
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.