RE: PHP Fatal error: Cannot redeclare class - high traffic.

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

 



Hello,

As far as I now from experience, this error message arises when you want
ton include classes definitions (typically 2 files) that define the same
class (here, "encrypt").

In my code, this occurs when I make a requie (or include) of the same
file more than once. 
The file is included more than once, so the class encrypt{} I inserted
multiple times =>error
This problem can  solved by using require_once or include_once.

The same problem may come from Windows, where the file names are not
case sensitive:
Check if you use a include (or require) of , for exemple, Encrypt.php
and encrypt.php or ENCRYPT.php and encrypt.php.
PHP consider those files as different, so event if you use require_once,
PHP will consider that he can include both (because it sees them as
different files)
The difference can be into the filename or into the filepath
Require_once("c:\Inetpub\wwwroot\my_project\Encrypt.php");
Require_once("c:\Inetpub\WWWROOT\my_project\Encrypt.php");
=>php will try to include the file twice, event if the filename
(basename) is different.


Hope this helps
vincent



-----Original Message-----
From: iestyn@xxxxxxxxx [mailto:iestyn@xxxxxxxxx] On Behalf Of iestyn
lloyd
Sent: vendredi 13 octobre 2006 15:25
To: php-windows@xxxxxxxxxxxxx
Subject:  PHP Fatal error: Cannot redeclare class - high
traffic.

Hi List,

First post, hope this is alright :)

I'm running: Windows Server 2003,  IIS 6.0, PHP 5.1.4 (ISAPI), AMFPHP
1.2.5, MySQL 5.0.24.

The box is getting a *lot* of hits. A gateway PHP file is being called
about 1,000,000 times per day.
I've got error logging enabled, and I find there's a lot of:

"PHP Fatal error:  Cannot redeclare class encrypt" This is not the
gateway, but another file that is called a lot.

I've been assured by the coder, who has checked the code time and time
again that it is *not* a problem with his code.

The problem only seems to occur when the server is at peak load, with
the file perhaps being called 40 times a second.

Has anyone encountered this on a similar setup?

I'm also getting quite a few " PHP Fatal error:  Maximum execution time
of 60 seconds exceeded " on mysql_connect statements, but this appears
to be a separate issue, which i'm also looking into.

Thanks for any advice,

cheers

iestyn

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

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



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux