In general, there is no big problem and it is quite easy to change permissions of a directory to 0777 or something different, you simply do (if you create)
mkdir('/project/data/videos', 0777) but this might not work…
If you check the permissions you will see that they are not
0755 - drwxr-xr-x and this is because of your
umask, which is 022 in this case.
So if we use 0777 as permission set, umask will be subtracted from our permissions.
Because of umask we have to first get the current umask (you don’t want to change it forever), set it to zero, create the dir with 0777 and then return the default umask
$umask = umask(0); mkdir('/project/data/videos', 0777); umask($umask);
Now the permissions of the created directory will be 0777, if you want you can read more about umask here