Ticket #252 (closed defect: fixed)
PHP version check should not block PHP when version mismatch is found
| Reported by: | tigertech | Owned by: | bart |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.9.6 |
| Component: | eAccelerator | Version: | |
| Keywords: | version | Cc: |
Description (last modified by bart) (diff)
I work for a hosting company ( http://www.tigertech.net/) using eAccelerator with PHP/FastCGI.
By default, eAccelerator returns FAILURE if the version of PHP doesn't match the exact version it was compiled for. This makes upgrades difficult: even if you recompile both PHP and eAccelerator, any PHP/FastCGI instances that launch between the time PHP and eAccelerator are upgraded (probably a few seconds) will completely fail.
We used to deal with this by disabling eAccelerator during PHP upgrades, but that's error-prone (easy to forget). We patched eAccelerator as follows -- it causes eAccelerator to still log an error and bail out before doing anything, but return SUCCESS instead of FAILURE so that the PHP instance can continue (albeit without eAccelerator support).
--- php5-eaccelerator-0.9.5.orig/eaccelerator.c 2006-10-11 05:45:52.000000000 -0700
+++ php5-eaccelerator-0.9.5/eaccelerator.c 2007-05-01 13:02:09.000000000 -0700
@@ -1946,11 +1946,15 @@
strcmp(Z_STRVAL(v),PHP_VERSION) == 0) {
ret = 1;
} else {
- zend_error(E_CORE_WARNING,"[%s] This build of \"%s\" was compiled for PHP version %s. Rebuild it for your PHP version (%s) or download precompiled binaries.\n", EACCELERATOR_EXTENSION_NAME,EACCELERATOR_EXTENSION_NAME,PHP_VERSION,Z_STRVAL(v));
+ /* tigertech: use fprintf instead of zend_error, because zend_error prints
+ to stdout which confuses mod_fcgid */
+ fprintf(stderr,"[%s] This build of \"%s\" was compiled for PHP version %s. Rebuild it for your PHP version (%s) or download precompiled binaries.\n", EACCELERATOR_EXTENSION_NAME,EACCELERATOR_EXTENSION_NAME,PHP_VERSION,Z_STRVAL(v));
}
zval_dtor(&v);
} else {
- zend_error(E_CORE_WARNING,"[%s] This build of \"%s\" was compiled for PHP version %s. Rebuild it for your PHP version.\n", EACCELERATOR_EXTENSION_NAME,EACCELERATOR_EXTENSION_NAME,PHP_VERSION);
+ /* tigertech: use fprintf instead of zend_error, because zend_error prints
+ to stdout which confuses mod_fcgid */
+ fprintf(stderr,"[%s] This build of \"%s\" was compiled for PHP version %s. Rebuild it for your PHP version.\n", EACCELERATOR_EXTENSION_NAME,EACCELERATOR_EXTENSION_NAME,PHP_VERSION);
}
return ret;
}
@@ -1998,7 +2002,9 @@
#endif
}
if (!eaccelerator_check_php_version(TSRMLS_C)) {
- return FAILURE;
+ /* tigertech: do not return FAILURE, because it causes PHP to
+ completely fail. */
+ return SUCCESS;
}
ZEND_INIT_MODULE_GLOBALS(eaccelerator, eaccelerator_init_globals, NULL);
REGISTER_INI_ENTRIES();
Change History
comment:3 Changed 3 years ago by bart
- Status changed from new to closed
- Resolution set to fixed
This patch was commited in revision [309]
comment:4 Changed 6 months ago by sim
decoration Changed 1 year ago by admin
bathtub Changed 1 year ago by admin
solar system Changed 1 year ago by admin
stair parts Changed 1 year ago by admin
solar supply Changed 1 year ago by admin
I've got bitten by that to quite some times. I'll certainly include this in the next release if the others like it too.