Re: Hi, i have a question on zend_eval_string

From: Date: Wed, 12 May 2010 05:27:38 +0000
Subject: Re: Hi, i have a question on zend_eval_string
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7222@lists.php.net to get a copy of this message
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

« previous php.pecl.dev (#7222) next »