ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-windows
php-windows
RE: [PHP-WIN] PHP Fatal error: Cannot redeclare class - high traffic.
by Vincent DUPONT other posts by this author
Oct 16 2006 1:17AM messages near this date
[PHP-WIN] PHP Fatal error: Cannot redeclare class - high traffic. | [PHP-WIN] @mssql_connect() versus mssql_connect()
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@[...].com [mailto:iestyn@[...].com] On Behalf Of iestyn
lloyd
Sent: vendredi 13 octobre 2006 15:25
To: php-windows@[...].net
Subject: [PHP-WIN] 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
Thread:
Iestyn Lloyd
Vincent DUPONT

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved