I avoid using (require|include)_once and instead, use constant define at the top of my php files to avoid redefining classes/functions.
At the top of a file I will have (say query.php):
<?php
global $query; // Shared global reference
if (defined('_QUERY_PHP_')) {
return; // return and do no more processing
}
define('_QUERY_PHP_', 1);
class query {
... rest of file with class/functions
}
$query = new query;
?>
When I have eaccelerator off, it works as expected. When I turn it on, I get
Fatal error: Cannot redeclare class query in [snipped]/query.php on line 0
FreeBSD 4.11
Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.7d
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend Technologies
zend_extension="/usr/local/lib/php/20020429/eaccelerator.so"
eaccelerator.enable="0"
eaccelerator.shm_size="0"
eaccelerator.cache_die="/tmp/eaccelerator"
eaccelerator.optimizer="1"
eaccelerator.debug="0"
eaccelerator.log_file="/var/log/eaccelerator.log"
eaccelerator.name_space=""
eaccelerator.check_mtime="1"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys="shm_and_disk"
eaccelerator.session="shm_and_disk"
eaccelerator.content="shm_and_disk"
eaccelerator.allowed_admin_path = "/usr/local/www/admin/ea"