Author Topic: cron job errors nws-alerts.php, godaddy host  (Read 580 times)

0 Members and 1 Guest are viewing this topic.

Offline johnah

  • Member
  • *
  • Posts: 35
    • Loris SC Weather
cron job errors nws-alerts.php, godaddy host
« on: July 08, 2019, 03:56:48 PM »
Hello All,

I am getting the error "unable to open cache file" when I run the cron job on my godaddy shared server.
I set this up through cpanel and am using php version 7.2.  I have had numerous calls to support and they say the problem is in my script but it will run when I call it through a browser.

Below is the message I get when the cron runs.  I would appreciate any help getting this resolved.
Thanks
John

<!-- nws-alerts.php - V1.43 - 14-May-2019 -->
<!-- 4 unique Zone entries found. Zones='CAZ513,CAC085,CAZ529,CAC087' -->
<!-- Cron job enabled -->
<!-- XML source: https://alerts.weather.gov/cap/wwaatmget.php?x=CAZ513&y=1 -->
<!-- HTTP stats:  RC=200 dest=23.198.4.70 port=443 (from sce=107.180.109.4)
      Times: dns=0.004 conn=0.022 pxfer=0.088 get=0.233 total=0.321 secs -->
<!-- XML source: https://alerts.weather.gov/cap/wwaatmget.php?x=CAC085&y=1 -->
<!-- HTTP stats:  RC=200 dest=23.198.4.70 port=443 (from sce=107.180.109.4)
      Times: dns=0.004 conn=0.021 pxfer=0.079 get=0.232 total=0.310 secs -->
<!-- XML source: https://alerts.weather.gov/cap/wwaatmget.php?x=CAZ529&y=1 -->
<!-- HTTP stats:  RC=200 dest=23.198.4.70 port=443 (from sce=107.180.109.4)
      Times: dns=0.004 conn=0.022 pxfer=0.074 get=0.322 total=0.396 secs -->
<!-- XML source: https://alerts.weather.gov/cap/wwaatmget.php?x=CAC087&y=1 -->
<!-- HTTP stats:  RC=200 dest=23.198.4.70 port=443 (from sce=107.180.109.4)
      Times: dns=0.004 conn=0.021 pxfer=0.071 get=0.260 total=0.331 secs -->
<!-- unable to open cache file -->
<!-- unable to open cache file -->
<!-- unable to open big icon cache file -->
<!-- Total process time: 1.3703 seconds -->

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: cron job errors nws-alerts.php, godaddy host
« Reply #1 on: July 08, 2019, 06:36:06 PM »
1) Can you supply the URL to the site?

2) Are you able to ssh into the server and determine a) that the cache directory is there and b) what its permissions are set to?
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: cron job errors nws-alerts.php, godaddy host
« Reply #2 on: July 08, 2019, 07:01:01 PM »
What is the exact command you are having the cron execute?

If you are just running the script via a php command, then it's likely that the environment (working directory) is not set to your document root, so the ./cache/ directory can't be found.

A crontab entry something like
Code: [Select]
*/5 * * * cd $HOME/public_html;/usr/local/bin/php -q nws-alerts.php would work better for you.  Note: you may have to change public_html to www and /usr/local/bin/php to a different PHP command location, depending on your website hoster.
« Last Edit: July 08, 2019, 07:04:04 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline johnah

  • Member
  • *
  • Posts: 35
    • Loris SC Weather
Re: cron job errors nws-alerts.php, godaddy host
« Reply #3 on: July 09, 2019, 11:40:16 AM »
Thanks for the responses.
Ken, the crontab entry you suggested worked. I appreciate your help, this was driving me nuts.
John

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2295
    • CNYWeather
Re: cron job errors nws-alerts.php, godaddy host
« Reply #4 on: July 09, 2019, 12:05:03 PM »
FWIW, I'm also using new GoDaddy with their snazzy CPanel too

Here's the string for my NWS Alerts cron job:

Code: [Select]
php -f /home/ht63ffwq1vvx/public_html/nws-alerts.php
ht63ffwq1vvx is the weird name of my hosting site on their server for some reason.
This I think was modified from their example or someone else used it on this forum.
Tony




Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: cron job errors nws-alerts.php, godaddy host
« Reply #5 on: July 09, 2019, 12:35:41 PM »
Usually $HOME shell variable will supply the path to your hosting root, so $HOME/public_html/nws-alerts.php should work fine (even if they move your hosting root in the future).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2295
    • CNYWeather
Re: cron job errors nws-alerts.php, godaddy host
« Reply #6 on: July 09, 2019, 03:19:47 PM »
Cool. Thank you Ken.

After this move to their latest and greatest servers (since my old ones were going away)
It took me forever to get the FTP figured out and a while with the cron jobs too.
Tony




Offline johnah

  • Member
  • *
  • Posts: 35
    • Loris SC Weather
Re: cron job errors nws-alerts.php, godaddy host
« Reply #7 on: July 10, 2019, 04:13:40 PM »
Thanks for the info Tony,
I tried using their example and could never get it to work.