This question already has an answer here:
There is a Cron job on Ubuntu 16.04 which runs a PHP script
$parseinfo = 'parseme.json'; $handle = fopen($parseinfo, 'w'); fwrite($handle, json_encode($res));
to parse data into a JSON file. The PHP script is supposed to write data within the same folder where this PHP script is located in but I've faced a problem that JSON is being saved into root's home directory:
This is how I set Cron job:
*/10 * * * * root /usr/bin/php /var/www/somederictory/somefolder/parse.php > /dev/null
ssh email@example.com cd /etc crontab -e :x
In short words: JSON is being saved into
/root while I want it to be saved into
What should I do to fix it?
Edit: It is not a duplicate, PHP works, JSON is being saved, but in a wrong way. And I'm asking to help me understand what's wrong with current Cron settings.