Re: Local version works - production breaks

From: Date: Sun, 08 Aug 2004 13:19:49 +0000
Subject: Re: Local version works - production breaks
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-193118@lists.php.net to get a copy of this message
Try adding if (!function_exists("function_name")) { function function_name ($blah) { // Function Code } } for each function. That will fix the redeclare problem which happens if you call your cards.php file in more than 1 file.. "Andre Dubuc" <aajdubuc@webhart.net> wrote in message news:200408072243.09259.aajdubuc@webhart.net... > On Saturday 07 August 2004 10:11 pm, Robby Russell wrote: > > On Sat, 2004-08-07 at 19:00, Ed Lazor wrote: > > > It could be that you have local error reporting set to none. It could > > > also be that you're using full paths when referencing files which then > > > breaks when moving files to a new server. Basically, there's a lot of > > > possibilities and I'm not going to have much luck helping unless you > > > include error messages. My guess is that resolving a few errors will > > > address a core problem and everything will start working. > > > > > > -Ed > > > > Yes, it's very possible that he isn't getting errors locally because his > > errors aren't on. > > > > Andre, > > > > You might check your error settings on your local server. You might even > > consider upgrading php on your local server to the same version and > > debugging. > > > > -Robby > > > > -- > > /*************************************** > > * Robby Russell | Owner.Developer.Geek > > * PLANET ARGON | www.planetargon.com > > * Portland, OR | robby@planetargon.com > > * 503.351.4730 | blog.planetargon.com > > * PHP/PostgreSQL Hosting & Development > > ****************************************/ > > > 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. 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 (#193118) next »