Search code examples
phpwordpresscronwgetdirectadmin

Can't get PHP-script running as a cronjob


Recently my site was moved to a different server, due to maintenance at the host. Ever since I can't this script to run as a cronjob anymore: http://www.filmhuisalkmaar.nl/wp-content/themes/filmhuis-alkmaar/cron/load-shows.php

I tried running it using PHP with the follow cronjob:

php /home/provadja/domains/filmhuisalkmaar.nl/public_html/wp-content/themes/filmhuis-alkmaar/cron/load-productions.php

But I kept getting the following error:

PHP Warning: require_once(../inc/api.php): failed to open stream: No such file or directory in /home/provadja/domains/filmhuisalkmaar.nl/public_html/wp-content/themes/filmhuis-alkmaar/cron/load-productions.php on line 3 PHP Fatal error: require_once(): Failed opening required '../inc/api.php' (include_path='.:/usr/local/lib/php') in /home/provadja/domains/filmhuisalkmaar.nl/public_html/wp-content/themes/filmhuis-alkmaar/cron/load-productions.php on line 3

I checked if the files stating missing were still in place. And they were. I checked the file permissions and they're set to 755, which should be more than fine. Right?

Then I tried wget with the following cronjob:

/usr/bin/wget -O https://www.filmhuisalkmaar.nl/wp-content/themes/filmhuis-alkmaar/cron/load-shows.php

But then I keep getting the following URL:

wget: missing URL

Usage: wget [OPTION]... [URL]...

Try ‘wget --help’ for more options.

I'm really at a loss here. Especially because it used to work fine in the past. It's very frustrating because these scripts are kind of essential for my site to stay updated.

Any help would really be appreciated. Thank you.


Solution

  • I will quote fvu's comment to my question, which I have tried and can confirm now as fully working:

    1) does /home/provadja/domains/filmhuisalkmaar.nl/public_html/wp-content/themes/filmhui‌​s-alkmaar/inc/api.php exist? 2) obvious error in wget usage (-O needs the name of the file in which to save the script output), try wget -O /dev/null https://www.filmhuisalkmaar.nl/wp-content/themes/filmhuis->alkmaar/cron/load-show‌​s.php

    Thanks a lot everyone, for your help!