[RESOLVED] Vesta - CentOS 7.5 - PHP script is not working in CRON Job
Posted: Thu Jan 17, 2019 5:38 pm
Hello,
I am new to Vesta CP. Recently I installed CentOS on UpCloud and installed Vesta CP. I have only one user "admin" and one domain name added. I have set a CRON to run a simple test PHP which writes date and time stamp to a file. The script is located under "domain.com/test/crontest.php".
My CRON command is:
The CRON is set to run this script every 5 min. Here is the PHP code of this script:
Neither the script is working nor any Log is written to /var/log/crontest.log file.
Can someone please guide me with the proper command to run this CRON job? Is this something to do with script execution user rights? How can I fix this issue?
Waiting for your valuable reply...
Cheers,
\r
I am new to Vesta CP. Recently I installed CentOS on UpCloud and installed Vesta CP. I have only one user "admin" and one domain name added. I have set a CRON to run a simple test PHP which writes date and time stamp to a file. The script is located under "domain.com/test/crontest.php".
My CRON command is:
Code: Select all
/usr/bin/php /home/admin/web/DOMAIN.COM/test/crontest.php >> /var/log/crontest.log
Code: Select all
#!/usr/bin/php -q
<?php
$logfile = "cronlog.txt";
$datestamp = date("d F Y, H:i:s") . "\n";
file_put_contents($logfile, $datestamp, FILE_APPEND | LOCK_EX);
?>
Can someone please guide me with the proper command to run this CRON job? Is this something to do with script execution user rights? How can I fix this issue?
Waiting for your valuable reply...
Cheers,
\r