Re: [PECL-DEV] Hi, i have a question on zend_eval_string
[email protected] ("xiangchao.liu") Wed, 12 May 2010 13:29:25 +0800
| Newsgroups | php.pecl.dev |
|---|---|
| Message-ID | <[email protected]> |
Many thanks to all of you, in fact, i am using a framework, i have to include a LARGE .php file (>70K) before every requests, although APC is enabled, request is still slow, i do not want to rewrite the file in C because of difficulty. And you are right, zend_eval_string() must be called after request startup. I will consider other ways to resolve the problem. Thank you again. On Wed, May 12, 2010 at 1:27 PM, Alexey Zakhlestin <[email protected]>wrote: > > On 12.05.2010, at 6:56, xiangchao liu wrote: > > > Hi: > > > > How can i call zend_eval_string() in PHP_MINIT_FUNCTION block? > > > > For some reason i want to register my PHP functions in > PHP_MINIT_FUNCTION, > > so that i do not have to define them in my .php files. Just like: > > > > PHP_FUNCTION(if_is_nil) { > > zend_eval_string("function if_real_is_nil($value) {\ > > return $value === nil;\ > > }", NULL, "if_real_is_nil" TSRMLS_CC); > > } > > > > When i call if_is_nil, the function if_real_is_nil() is defined.so i can > > call it later. > > > > But, when i move zend_eval_string(...) to PHP_MINIT_FUNCTION block, > compiler > > goes well, but can not apache can not load the module anymore. > > > > Is there anyone knows how to get this work? > > > > Thanks in advanced. > > what stops you from defining if_real_is_nil as PHP_FUNCTION and writing it > in C? That would be the proper way to do it. > zend_eval_string can't work in PHP_MINIT, as engine is not fully > initialised yet -- Architect, Bokan Technologies BokanTech.com