0

I have some PHP code that pulls data from multiple sources and then dumps the results into a DB2 Database. This PHP code works when you enter the URL for the PHP code. Now trying to have it run twice a day using a crontab. It doesn't seem to be working and the log file shows nothing. I'm using wget and thought it was timing out, so I have tried the following crontabs:

00 06 * * * wget http://website/phpcode.php >> /home/website/crontab.log
00 06 * * * wget -T0 http://website/phpcode.php >> /home/website/crontab.log
00 06 * * *  wget --timeoute=0 http://website/phpcode.php >> /home/website/crontab.log

When I try to run the phpcode.php from the Linux command line I get:

Fatal error: Call to undefined function db2_connect().

Any idea's how to get the code to work using the crontab with wget?

hek2mgl
  • 152,036
  • 28
  • 249
  • 266
newbie_146
  • 127
  • 1
  • 9
  • 1
    if you have access to the terminal, can you please try to invoke the command directly and check the output? `wget http://website/phpcode.php >> /home/website/crontab.log` – GrafiCode Oct 13 '15 at 14:46
  • see this http://stackoverflow.com/questions/5766772/using-wget-to-run-a-cronjob-php on how to use `wget` to execute a remote script – Alex Andrei Oct 13 '15 at 14:46
  • there is two way to execute the php scripts from crontab one using wget and another using curl.. you can use anyone of them to execute php script – sandeep_kosta Oct 13 '15 at 14:51
  • 3
    @sandeep_kosta Well there is a third way... `php` – Alfwed Oct 13 '15 at 14:54
  • 1
    And how should the second and third way help here? – hek2mgl Oct 13 '15 at 15:44
  • @GrafiCode Studio, did that and it failed when checking for the certificate. I added the --no-check-certificate and looks like it might have fixed it, but going to check again later to be sure. Thanks! – newbie_146 Oct 13 '15 at 19:13

0 Answers0