Web Weather > Weather Website PHP/AJAX scripting

cron job errors nws-alerts.php, godaddy host

(1/2) > >>

johnah:
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 -->

Jasiu:
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?

saratogaWX:
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: ---*/5 * * * cd $HOME/public_html;/usr/local/bin/php -q nws-alerts.php
--- End code ---
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.

johnah:
Thanks for the responses.
Ken, the crontab entry you suggested worked. I appreciate your help, this was driving me nuts.
John

CNYWeather:
FWIW, I'm also using new GoDaddy with their snazzy CPanel too

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


--- Code: ---php -f /home/ht63ffwq1vvx/public_html/nws-alerts.php
--- End code ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version