Re: APC + "Fatal error: Cannot redeclare class..."

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jon wrote:
> So... I've got some code that works just fine without APC, but dies when
> I add it.
> 
> Here's the error:
> Fatal error: Cannot redeclare class

that error doesn't tell us much more than you in the context you give...
but I'm gonna put money on the fact that your doing something like include_once()ing
some class file then include_once()ing the same file but with a different [relative]
path and that APC is getting confused thinking that these files are different...

try going through you code and making all [include|require]_once calls to use a single
form of path (i.e. that all includes for a given file are identical)

you can use echo statements in the top of each class file to track down which class is
seemingly being included twice.

if all that fails you can still use the 'apc.filter' ini setting to exclude certain
files from being cached (using regexp declarations to exclude files based on filename)
- this assumes your class files have a 'std' naming convention (e.g. Foo.class.php).
I use the same technique to stop class definitions being cached to overcome a problem
that my cached class defs cause segfault which I can figure out (that reminds me I
should try a newer version of APC if it's been release :-)

> 
> php -v =
> PHP 5.1.2 (cli) (built: Jul 18 2006 23:21:00)
> 
> ... any ideas what's up? Obviously, there are other ways I can improve
> performance on that box, but I'd love to try APC.
> 
> Thanks...
>     -- jon
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux