Re: Need to Run a PHP script using CRON or ?

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

 



From: "Jonathan Villa" <jvilla@isdesigndev.com>

> > wget -q -O - www.domain.com/cron.php > /dev/null

>
> Interesting... how does this fair concerning security?  So I'll have to
> have this file located in my document root, is this a good thing?  My
> current directory structure consists of several files located outside
> the doc root.  I guess I could always include it onto a page

Well, I guess it would depend upon what your "cron.php" does. You must be
aware that anyone can just type in the URL and run the script at any time,
not just when the cron process runs it. For example, my "cron.php" script
creates a mysql backup file and erases any backup files older than 30 days.
When it runs, it first checks if the backup for today was already made or
not. If it's already there, it does nothing. So, you can call this script
all you want and it's not going to mess up anything. Again, it depends on
what your script is doing, though.

Yes, it's safer to keep it outside of the webroot and call it via the
command line. This way you know it's only being called by cron and only when
you want it. It just depends on whether you can do that on your system or
not.

---John Holmes...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux