0

I am trying to execute a php script in my linux server. the script will run everyday at 8 am. I have uploaded my crontab in linux server and the php file update1.php Script in my crontab is given below. But this isnt updating my databse. where am i doing wrong ? Am i missing something here. Thanks in advance.

crontab

  0  8  *  *  *  http://www.mywebsite.com/update1.php
rahman_akon18
  • 336
  • 3
  • 14

2 Answers2

0

You can use --spider option of wget for this purpose.

0  8  *  *  *  wget --spider http://www.mywebsite.com/update1.php

--spider indicates not to download anything (we just want to go through the pages, that’s all)

A.A
  • 2,603
  • 1
  • 18
  • 22
0

This line/code in your crontab:

http://www.mywebsite.com/update1.php

is not an execution of the script, it's just the url to it. You should download the php script, and put it locally on your linux server. That would make things simpler and much more reliable.

I would login to your linux server, use wget to download the script, chmod it to make sure it's executable, and mv it to wherever you want on your server:

wget http://www.mywebsite.com/update1.php -O update1.php
chmod 755 update1.php
mv update1.php /path/to/where/you/want/script

Then now that you have the script locally on your linux server, edit your crontab (crontab -e), and add the following line:

0 8 * * * /path/to/where/you/want/script/update1.php

drewyupdrew
  • 1,549
  • 1
  • 11
  • 16