I need to create a daily directory (/YYYYMMDD). I'm using mkdir() function. When I run it manually it works fine, but when it is executed by cron it fails to create the directory.
I thought the problem was with the permissions, but I even tried modifying the directory to 777 and it still didn't work.
This is how I use mkdir():
if (!file_exists($auxfile)) { if (!@mkdir($auxfile, 0777, true)) { $error = error_get_last(); echo $error['message']; } }
If you are doing it old-style via the examples in DirectAdmin. You need to make sure you use the main path. For example.
mkdir('/home/DOMAIN.COM/public_html/results/'.$auxfile);