List Info

Thread: Bug: PHP/YAZ doesn't honor php.ini-settings --- sometimes.




Bug: PHP/YAZ doesn't honor php.ini-settings --- sometimes.
country flaguser name
Germany
2007-04-17 10:23:31
Hi,

I'm currently trying to track down a nasty issue w/ the PHP
yaz
extension (1.0.8), occuring on the non-CLI builds (checked
against
apache module -- running in prefork mode, so not a threading
issue --
and the FastCGI build). PHP is 5.2.1 (newest).

The issue:
-----------
The module does not honor php.ini settings, such as
yaz.max_links and
yaz.keep_alive. This only happens for some calls. As well,
it doesn't
respect the default values (100/120). Instead, in the cases
when it
"doesn't work", both values are in fact set to
zero (0). Obviously, any
YAZ query would fail since the extension's pool of YAZ
connection
handles (max_links) has effectively a size of zero.

Fix:
-----
See attached patch. It introduces proper initialization of
the globals,
according to PHP extension writing docs (for whatever
reason,
specifying a default value in STD_PHP_INI_ENTRY doesn't make
it
initialize the global variable).

This alone did prove to be insufficient. Also, there was a
missing
UNREGISTER_INI_ENTRIES(); in the MSHUTDOWN_FUNCTION.

Both corrections together seem to fix the problem.
Note that I added an initialization for the log_file and
log_mask
settings, too. I'm not sure if that is needed, too, but I
think it
can't hurt.


Cheers,

-hwh

_______________________________________________
Yazlist mailing list
Yazlistlists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list

  
Re: Bug: PHP/YAZ doesn't honor php.ini-settings --- sometimes.
country flaguser name
Denmark
2007-04-17 13:02:24
Hans-Werner Hilse wrote:
> Hi,
> 
> I'm currently trying to track down a nasty issue w/ the
PHP yaz
> extension (1.0.8), occuring on the non-CLI builds
(checked against
> apache module -- running in prefork mode, so not a
threading issue --
> and the FastCGI build). PHP is 5.2.1 (newest).
> 
> The issue:
> -----------
> The module does not honor php.ini settings, such as
yaz.max_links and
> yaz.keep_alive. This only happens for some calls. As
well, it doesn't
> respect the default values (100/120). Instead, in the
cases when it
> "doesn't work", both values are in fact set
to zero (0). Obviously, any
> YAZ query would fail since the extension's pool of YAZ
connection
> handles (max_links) has effectively a size of zero.
> 
> Fix:
> -----
> See attached patch. It introduces proper initialization
of the globals,
> according to PHP extension writing docs (for whatever
reason,
> specifying a default value in STD_PHP_INI_ENTRY doesn't
make it
> initialize the global variable).
> 
> This alone did prove to be insufficient. Also, there
was a missing
> UNREGISTER_INI_ENTRIES(); in the MSHUTDOWN_FUNCTION.
> 
> Both corrections together seem to fix the problem.

Thanks for this. You patch has been applied to the CVS head
version. And 
so will be part of 1.0.9 - when out.

> Note that I added an initialization for the log_file
and log_mask
> settings, too. I'm not sure if that is needed, too, but
I think it
> can't hurt.
Yep.

/ Adam

> 
> 
> Cheers,
> 
> -hwh
> 
> 
>
------------------------------------------------------------
------------
> 
> diff -ru yaz-1.0.8/php_yaz.c yaz-1.0.8-hw/php_yaz.c
> --- yaz-1.0.8/php_yaz.c	2006-12-23 13:17:30.000000000
+0100
> +++ yaz-1.0.8-hw/php_yaz.c	2007-04-17
16:14:52.867064064 +0200
>  -1917,6 +1917,10 
>  static void php_yaz_init_globals(zend_yaz_globals
*yaz_globals)
>  {
>  	yaz_globals->assoc_seq = 0;
> +	yaz_globals->max_links = 100;
> +	yaz_globals->keepalive = 120;
> +	yaz_globals->log_file = NULL;
> +	yaz_globals->log_mask = NULL;
>  }
>  /* }}} */
>  
>  -2030,6 +2034,9 
>  #endif
>  
>  	yaz_log_init_file(0);
> +
> +	UNREGISTER_INI_ENTRIES();
> +
>  	return SUCCESS;
>  }
>  
> 
> 
>
------------------------------------------------------------
------------
> 
> _______________________________________________
> Yazlist mailing list
> Yazlistlists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list


_______________________________________________
Yazlist mailing list
Yazlistlists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )