php - How to set up a cron
Get the solution ↓↓↓I have this PHP script which updates my database when the webpage is visited via https://......
<?php
//
database connection file.....
if($wa->cron()){
echo "Updated";
}
?>
How can I set a cronjob to visit this every 24hours?
I entered these commands but didn't work /home/xxxxx/public_html/cron.php and /home/xxx/public_html/cron.php
and I entered the web address directly still didn't work.
Please help.
Answer
Solution:
If you're trying to setup a cronjob in linux to call your php file every 24 hours here's how you do it.
In your terminal typecontab -e
, select your preferred editor and at the end of the file type:
0 0 * * * php /path/to/your/script.php
This will call that script every day at midnight (your server's time). Also be careful, as crontab runs under your currently logged user and running these commands asroot
might expose your server to some dangers.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to a member function getclientoriginalname() on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.