i found that my problems were as such:
i had this information
$mode = '0775';
chmod($PathtoFile, $mode);
however that did not work
I found that i needed to use octdec() first like this
chmod($PathtoFile, octdec($mode));
the problem that i was that apache didnt belong to the group i wanted to set. after i added apache to that group the program worked...
thanks for the help