On Tue, 20 Mar 2007 13:17:24 +0100 Michael Wallner <[EMAIL PROTECTED]> wrote:
> Michael B Allen wrote: > > Hi, > > > > Is there a way to get the version of the PHP binary that loaded an > > extension from within the extension? I don't mean the PHP version the > > extension was compiled with (PHP_VERSION), I mean the version of the > > PHP binary itself? > > > > Can I call the phpversion function from within an extension? > > > > Similarly is there a way to get the zend API version of the PHP binary > > (not the version the extension was compiled with)? > > [EMAIL PROTECTED]:~/cvs/php-5.2$ grep -E 'version.*\);' Zend/*.h > Zend/zend_API.h:ZEND_API char *zend_get_module_version(char *module_name); > Zend/zend_extensions.h:void zend_append_version_info(zend_extension > *extension); > Zend/zend.h:ZEND_API char *get_zend_version(void); > > > You could query ext/standard for the PHP version, everything else should be > self explanatory. Yes, that does give me the PHP version. Thanks. The get_zend_version function returns a string like 'Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies\n'. It would be nice to be able to get the ZEND_MODULE_API_NO (e.g. 20060613) the standard module was compiled under. I'm still confused about how many versions of extensions I need to provide with my product. Currently I just compile it against late versions of 4, 5.0, 5.1 and 5.2 and hope for the best. But looking at ZEND_MODULE_API_NO changes in webcvs shows it changes more frequently than that. But so far I haven't ran into major problems with ZEND_MODULE_API_NO so maybe I'm just being paranoid. From looking at zend.c it looks like it will print diagnostic info if some tries to load an incompatible extension. Mike -- Michael B Allen PHP Active Directory Kerberos SSO http://www.ioplex.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php