Issue
I have an application that I am transferring to a new server. In doing so the upload feature for customers accounts stopped working because the owner of the folders was 'ftp' and not 'apache' I solved it by renaming the folder and then using a directory copy function that I copied and pasted from somewhere in to a new folder with the correct name and it was all cool after that.
My question is this, can php change the ownership of a folder or files?
Solution
Yeah, php can change ownership of a file. Use chown($file, $user)
. You could write a simple recursive script to change owner for each file using chown.
Answered By - Cyclone Answer Checked By - David Marino (WPSolving Volunteer)