Agree with the @jon answer. Just added modified the path to create the log
directory inside the root
function wh_log($log_msg) {
$log_filename = $_SERVER['DOCUMENT_ROOT']."/log";
if (!file_exists($log_filename))
{
// create directory/folder uploads.
mkdir($log_filename, 0777, true);
}
$log_file_data = $log_filename.'/log_' . date('d-M-Y') . '.log';
file_put_contents($log_file_data, $log_msg . "\n", FILE_APPEND);
}
just added $_SERVER['DOCUMENT_ROOT']