Re: [PHP Guru question]: run php script from within pecl extension
| From: | Sara Golemon | Date: | Fri, 29 Sep 2006 18:47:20 +0000 |
| Subject: | Re: [PHP Guru question]: run php script from within pecl extension | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-25898@lists.php.net to get a copy of this message | ||
> For several reasons I need to call a php script every x minutes.
> I need that on several platforms so I started to write a pecl
> extension that implements something like a cron service.
>
Why not cron then?
> Obviously I miss something in initing php, because php
> crashes in main/streams/streams.c function php_stream_locate_url_wrapper()
> when I call php_execute_script()
>
Correct. You're not in a request (you're probably not even in an
identifiable/unique thread context). Both are fixable by spinning up a
context at thread startup and either (A) wrapping a request
activate/deactivate around that timer, or (B) wrapping the
activate/deactivate just inside your thread context (giving you a
single-uberlong-running request).
> because the variable
> 'wrapper_hash' inited at the very beginning in that
> function appears to become a bad value.
>
Which tells me that both of the issues above are relevant.
But coming back to the first question: What's wrong with cron?
-Sara