Re: Earliest zend_eval_string can be called?
| From: | Alexey Zakhlestin | Date: | Sat, 18 Sep 2010 10:52:38 +0000 |
| Subject: | Re: Earliest zend_eval_string can be called? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49764@lists.php.net to get a copy of this message | ||
On Sat, Sep 18, 2010 at 1:37 AM, Matthew C. Rice <mrice@rcs.us> wrote:
> Hello,
>
> I was wondering how early a zend_eval_string call can be made. Currently
> it works fine in a PHP_FUNCTION(), but was hoping to put it in a PHP_MINIT()
> in hopes of it just executing once.
>
> It seems PHP_MINIT() is too early, and is causing failures. I came across
> PHP_GINIT_FUNCTION(), but can't seem to find when its called exactly, but
> the same situation as PHP_MINIT() seems to be the case, where its too early.
>
> In short, I am wondering if there is any place I can put the
> zend_eval_string() call in hopes of it running just once, so its result
> could be retained throughout the module execution.
definitely, not earlier than PHP_RINIT(), which doesn't help you.
all php's "userland" code is executed in the sandbox and sandbox
exists between PHP_RINIT and PHP_RSHUTDOWN
the only way to execute userland code before serving requests is to
use long running process, which serves requests from userland.
That's what I do in http://github.com/indeyets/appserver-in-php
--
Alexey Zakhlestin
http://www.milkfarmsoft.com/