It's been a while since since I've been stuck for hours with no help from google searches, but here I am. I will say ahead of time that my problem might have something to do with my webserver or ftp servers configuration, so keep that in mind.
For years I've used the same system of managing files with permissions without problems. Recently we had to switch FTP server software (from Pure-FTPD to ProFTPD). Ever since then there keeps popping up these little differences but this issue seems more like an error than just a bit of code that needs changed.
This is basically how things work:
1 - Upload the website with a regular FTP client.
2 - Use a php script on a remote server to update appropriate files and directories to 0777 (uses ftp_chmod()).
3 - The site will add files to the 0777 directories and immediately chmod them to 0777.
4 - These files can be manipulated through an FTP client or a PHP script properly.
If there is a file created with PHP and chmod'ed to 0777 and I try to do step 2 on it, the ftp_chmod() fails. I'm guessing it is because it's not being run as the proper owner. But if I try to do the same operation with a normal FTP client, it works. I would have thought those two methods would give the same results since they are both FTP commands using the exact same login credentials.
Am I able to set what owner/group php ftp commands are run as? Any other ideas or resources would be appreciated.