Cant Create folder with full permission on ubuntu 14.04
Solution 1:
From this SO answer:
You can use
umask()
immediately before the fopen() call, but umask shouldn't be used if you're on a multi-threaded server - it'll change the mask for ALL threads (e.g. this change is at the process level), not just the one that you're about to use fopen() in.e.g.
$old = umask(000); fopen('foo.txt', 'w'); // creates a 0666 file umask($old) // restore original mask
It'd be easier to simply chmod() after the fact, however:
fopen('foo.txt', 'w'); // create a mode 'who cares?' file chmod('foo.txt', 0666); // set it to 0666