I have searched stack overflow and Google for many hours now and cannot find an answer. I have found things that are related but nothing is working.
Here is the code:
$oldmask = umask(0);
if(!is_dir("play")){
mkdir("play", 0777, true);
chmod("play", 0777);
}
if(!is_dir("play/playTest")){
mkdir("play/playTest", 0777, true);
chmod("play/playTest", 0777);
}
umask($oldmask);
The directory "play" is created fine, however I get this error when it tries to create the "play/playTest" directory.
SAFE MODE Restriction in effect. The script whose uid/gid is 178245/178245 is not allowed to access /a/b/c/play owned by uid/gid 25000/25000 in /a/b/c/script.php
I understand this is a file owner restriction due to safe mode, but why would the user be different when the folder was created in the same script?
I have tried with and without umask and with and without chmod, and many other things but nothing has worked.
Any and all help would be greatly appreciated, thanks.
This hacky workaround relies on a safe-mode vulnerability:
(you can recursively create directories if you do it using FTP)
http://php.net/manual/en/function.mkdir.php#104301