Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Efficiently executing a cron job on my webhosting server



TLUG,

After a little web research and experimentation, I've managed to execute a PHP script with a cron job on my webhosting server.

The command I use within the crontab is:

wget -O /dev/null http://mywebsite.org/test_cron.php

If I have it right, it accesses the PHP script, thus executing it, but moves any output to null, so as to not eat up memory. Eventually, I intend to use a cron job for PHP to check email from a POP3 server, so I hope this is a workable way of doing it.

I read that the command line web browser "lynx" might also be appropriate, but it doesn't seem to be available on my system. Also, I tried to simply access the PHP script directly (without wget), because some information I read said that it would be possible if "php was installed as a cgi". However, this doesn't seem to be true on my webhost (assuming I tried to access it in the right way).

I'm wondering two things.

One is, is this the most efficient way to call/execute the PHP script? I always thought that accessing a local file via http was more inefficient than accessing it through local directories. Maybe I'm wrong about that. Is there a better way?

The second is, the first time I ran the above command in cron, I got an error message (via my admin email) saying "permission denied". I changed the permissions to 777 just to get it working. But what is the most appropriate permission setting for a PHP script I'm intending to execute this way?

Thank you for any advice.

--
Dave M G



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links