1

I have setup a cron job to run a PHP file every 30 minutes:

lynx -source public_html/scripts/file.php

The result comes through to an email but seems to get this error:

Can't Access `file://localhost/home/username/public_html/scripts/file.php' Alert!: Unable to access document.

lynx: Can't access startfile

  • What is the job supposed to do ? Does the job work if you run it by hand (command line) ? – leonbloy May 1 '10 at 14:48
  • Lynx is a web browser, so it needs an uri for a web resource. But you could use php to run the script. – Aif May 1 '10 at 15:05
3

Several things are wrong here.

First, before putting a command in crontab, check that it works by running it yourself.

Second, if you want the html code generated by a (dynamic) php webpage, you must access trough the web server, not reading the php from from the filesystem. In the case of a php webpage, an alternative (not necesarily equivalent) would be to just invoke the php interpreter from the CLI:

php public_html/scripts/file.php

Third, no need to you use lynx (a text browser) for that, go wget:

wget http://localhost/scripts/file.php  

Perhaps you must change the url, that depends on your webserver configuration. Load it first in your web browser to check.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy