@
@
@neakeds2018-05-08 03:30:30
PHP
@neakeds, 2018-05-08 03:30:30

Сron executes the script but the file from the script is not saved, how to set it up correctly?

Hello, I put a php script in cron, the script should save the data to a text file, but the data is saved only when I write the output in the cron.
How I'm trying to do it:
*/10 * * * * /usr/bin/php /var/www/site/index.php
The script saves the data to a file, but for some reason they are not written.
How I get the data:
*/10 * * * * /usr/bin/php /var/www/site/index.php > /var/www/site/log.txt
In this case, I get the data but the script does not write the log, the file that was supposed to be saved by the script is simply omitted.
Please tell me how can I solve this problem? Requires the usual execution of a script in which the saving of data and work logs is implemented.
Thank you in advance.
I found a problem, the script did not specify an absolute path to the folder with logs. I apologize for my inattention.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2018-05-08
_

file_put_contents(dirname(__FILE__).'/output.log', __LINE__);

recorded?

A
Anton Shamanov, 2018-05-08
@SilenceOfWinter

usually such things are in the documentation of the hoster

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question