Other posts have suggested using an absolute (full) path. I appear to do this.
Another post admitted using a virtual server. I am not doing that.
This is my code.
$dt=date("Y.m.d");
$tm=date("H:i:s");
$ip=$_SERVER['REMOTE_ADDR'];
$variables_directory='variables';
$root_path=dirname($_SERVER['SCRIPT_FILENAME']);
$pathdir0=$root_path.'/'.$variables_directory;
$old_umask = umask(0);
if(!file_exists($pathdir0))@mkdir($pathdir0, 0777,true);
$pathdir1=$pathdir0.'/'.$dt;
if(!file_exists($pathdir1))@mkdir($pathdir1, 0777,true);
$pathdir2=$pathdir1.'/'.str_ireplace(':','',$tm);
if(!file_exists($pathdir2))@mkdir($pathdir2, 0777,true);
$pathdir3=$pathdir2.'/'.$ip;
if(!file_exists($pathdir3))@mkdir($pathdir3, 0777,true); // <<<<<
This code exists on a live site which uses error handling to catch errors and warnings. I often receive the following Unhandled Warning.
Line: 4956
Message: mkdir() [function.mkdir]: File exists
I have highlighted Line 4956 in the above section of code with <<<<<.
These warning messages which are emailed to me are really annoying.
Any ideas on how to stop the condition from occurring?