Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6845739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:32:16+00:00 2026-05-27T00:32:16+00:00

I know this has been answered before and why this is caused. However, in

  • 0

I know this has been answered before and why this is caused. However, in my case, the problem is happening only on MacOS Lion (10.7) which is on php 5.3.6. The same code base is running on my windows 7 machine which is on php 5.3.8.

I have used require_once all over the place. The code fragment that seems to be causing the problem is:

class DbBase
{
   ...
}

in a file that is included from multiple files. However the error disappears if I wrap the class declaration inside of:

if (class_exists('DbBase') != true)
{
    class DbBase
    {
        ...
    }
} 

I have this scenario:

File DBBase.php:

defines Class DBBase

File A_DB.php:

require_once("DBBase.php")

File B_DB.php:

require_once("DBBase.php")

File foo.php:

require_once("A_DB.php")
require_once("B_DB.php)

So the file DBBase.php does get included twice. Does it?

Any insight is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:32:16+00:00Added an answer on May 27, 2026 at 12:32 am

    This error occurs when you declare a single class multiple times instead of once ; The code below would throw that error.

    class phpp{}
    class phpp{}
    

    It is unlikely that the behaviour is not the same on 5.3.6 and 5.3.8 as there haven’t been any significant changes in classes and objects.

    You should check for duplicated codes in the files you are requiring once. . .

    EDIT :

    The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.

    So in your case it is not being included multiple times, whereas it would if you use require or include.

    However you should restructure your entire code to prevent class redeclaration’s.

    class lol{}
    if(!class_exists("lol")){
        class lol{
            function ll (){
                return "ss";
            }
        }
    }
    
    echo lol::ll(); 
    

    You wouldnt be able to access that ^^ , since its still a redeclaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been answered here before, however even after following all the
I know this has been answered before, but it seems that executing the script
I know that something similar to this has been answered before but its not
I know this has been answered before in different ways, but I am a
I know this has been answered before, but I'm a newb and I can't
I know this has probably been answered before, but I cannot find much information
I know this question has been answered before in this thread , but I
Don't know if this has been answered before. Have custom routes to users. If
I know this question has been asked and answered before, but none of the
I know this question has been asked and answered before. But when I try

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.