Reconciling apache file user with PHP script user to write to file

view full story

http://serverfault.com – I solved a problem regarding changing the umask of a file directory here: Chmod wont stick But now I have a new problem all together. PHP fails to write to files on that directory even though they are all chmod 644, fulle read write access to users, groups and public. After executing ls -la in SSH I found out that the user for the files was apache. After executing my PHP script with get_current_user() I found out that its user is foo. The default user. To give a little background, the files are uploaded through XHR via file upload and a http request. That's why apache own them. My PHP script (HowTos)