the existing dir is probably brought there by ftp.
so the dir owner is the ftp user
php is executed by another user (from "others", 3rd number)
hence you have to change the user of the dir to whatever the
user of php(apache) is, maybe "apache", "wwwrun" or "nobody"
(don't ask me how, I have no problem using 777 😉
if your webhoster has configured everything properly, it shouldn't be
a prob I guess)
p.s. now the apache user has only 5 = 4+1 = read+execute permissions, needs +2 = write, too)