Re: Local version works - production breaks

From: Date: Sun, 08 Aug 2004 08:54:36 +0000
Subject: Re: Local version works - production breaks
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-193126@lists.php.net to get a copy of this message
> Robby, > > I just enabled log_errors locally. No errors (as I thought). > > Since I am hacking a previously written site, the problem seems to arise most > when accessing his pre-built functions across pages. For instance, he uses a > 'cards.php' to store all display functions -- showleft() -- showcentre() , as > well as the connect() function. Hi Andre, make sure to use require_once for all includes. This will make sure to only include each file once and will trigger a fatal error if the file cannot be found because of a wrong path or whatever. Hope this helps, Torsten Roehr > Since its a persistent connection -- he opens > the db once, then performs various queries in it. However, since 'cards.php' > has already been called once by a page that might require both showleft() and > showcentre() -- it barfs and says that it cannot 'redeclare' the showleft() > function that has already been declared?? That is really some weird -- > particularly when it works so well (as expected) locally - and also since I'm > not 'redeclaring' but calling it for use! > > I cannot fathom why the production site would give this error. Perhaps I need > to do absolute paths for all headers? But it doesn't make sense that a > function cannot be called many times -- declaring it once, yes, but calling > its use?? If that were the case, then one might as well write it out longhand > for each use, and forget the concept of 'functions'. > > I think I should look at the error logs for the site -- maybe they will clue > me in where I should look. > > Thanks, > Andre

« previous php.general (#193126) next »