Re: Daemon
| From: | O. | Date: | Fri, 14 Jul 2000 22:22:32 +0000 |
| Subject: | Re: Daemon | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-1101@lists.php.net to get a copy of this message | ||
""Brian Rak"" <brian@capturelabs.com> wrote in message
news:8knvr7$hn0$1@toye.php.net...
> Hello,
>
> I'm wondering if it's possible to create a daemon with PHP. I want to set
up
> a script to run in the background and watch a folder. When there's any
> change to it, I want the script to establish a connection with an ftp site
> and upload the file. So my questions are: 1. Are daemons even possible
with
> PHP?
> 2. How can I detect changes to local files?
You want Perl (maybe) or, even better, C or C++. PHP could conceivably run
as a background process if run from the commandline in a Unix environment,
but I don't think it was designed for that. Strictly speaking, I don't know
if that's the definition of a daemon or not ;) .
As for your second question, you would have to create some type of loop in
which you check the length of the file or the last modify date. If you get
the above working, I'd do some reasonable interval like every 30 minutes.
IMHO and as it seems to be implied in the docs, PHP is not designed for what
you're trying to do, however.
--
O.