Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com May 2 '10 at 10:04

This question came from our site for professional and enthusiast programmers.

    
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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.