My site is being hosted by a hosting company. Before they were going PHP version below 4.3.0... i got my site's scripts running perfectly.. but now... they have upgraded to 4.3.0 all my scripts are issuing errors which are very uncommon if not unfriendly error for any PHP upgrades.. at least that's what the server's administrator said to me when I asked him to explain to me regarding the problem.. here are some of the errors. Take note that before they ( my host server's admin) upgraded their PHP module to 4.3.0, all of my scripts are running running ok...

Fatal error: Cannot redeclare get_news_list() in /home/paulinos/public_html/classes/class.news.php on line 21

Fatal error: Cannot redeclare get_product_list() in /home/paulinos/public_html/classes/class.products.php on line 88

Even the FastTemplate class that I'm using is issuing an error.... redeclare error.. Is this error, an error that is caused by the upgrades or other reasons? I was told by the administrator to upgrade my script.. but I want to ask you guys. Should I upgrade or there is something wrong with their system? If ever I should upgrade, what would that be? I'm not familiar with the changes from versions 4.0.6 upto 4.3.0... If PHP.net have some new specs ... please include it here so I could fix the problem and get my site up and running again.. Thank you very much

jun

    For what it's worth, I get very similar errors. My host recently upgraded to 4.3.0. Ever since, I've been getting "cannot redeclare gc() in session.inc".

    I'm using PHPlib . . . mainly because I did most of this development over two years ago. If I were starting over from scratch, I probably wouldn't be using it . . . but here I am.

    😕

      Me to: :-( some people here are saying that method overloading is not supported by PHP.. .. well, if its not.. then how did the FastTemplate creator made two methods with the same name.. but different arguments? Even my classes also contains overloaded methods.. which are working perfectly in previous versions.. I say, PHP people are giving us a hard time on this. Imagine if we're going to start from scratch.. again? I'm planning to rename all of my overloaded methods to....

      method (args)
      method(args,args)

      to
      method (args)
      method2 (args,args)

        8 days later

        Since my host upgraded the php version to 4.3.1 ( php info at http://php.cedant.com) all my pages using FastTemplate class do not work and error out. The error thrown is
        Fatal error: Cannot redeclare clear_parse() in class.FastTemplate.php3 on line 527

        I guess its the same issue all you guys are having. My web site is virtually down. If anybody has found a solution or workaround, please please let me know. I would really appreciate any help.

        Thanks in advance

        Nishu

        nishu@yamunda.com

          What I ended up having to do in my situation is modify the offending script.

          I was receiving a "cannot redeclare gc() in session.inc" error.

          I reviewed session.inc and sure enough, gc() is declared twice within the same scope. In fact, I'm just a bit surprised that this ever worked . . . even in 4.2.x and earlier.

          Alas, I reviewed the two different gc()'s and realized that they were very similar and used in similar ways. So, I just commented out one of them. (If I remember correctly, gc() is mainly used to clean up session variables.)

          So my only suggestion to you is to hack around in your fasttemplate library files. Get very familiar with the function that is getting declared twice . . . then make whatever modifications you need to avoid redeclaring it.

          I'm not at all familiar with fasttemplate, so I'm not going to be of much help on your specific problem.

          Best of luck,
          DLB

            I converted my site to Smarty template engine.. its much easier and powerful. FastTemplate is too messy for me... try it!

              3 months later

              Hi juneym,

              I have a site using FastTemplates running now on PHP 4.3.1

              I came across the usual:

              Cannot redeclare clear_parse() that everyone using FastTemplate get with the above Php Version and also fixed that up. 😃

              After a week of not checking my site, I went back to it and now only get this:

              ERROR: get_template() failure: [./templates/]

              I am getting tired of all the running around and chasing new errors as I am not a real PHP programmer. The error seems simple but I have tried hacking at it and have failed to resolve the above new Error. 😕

              When you say you converted your site to Smarty, can you advise us did you convert from FastTemplate?

              If you did, was it a big process or a major re-write? and would you recommend it for Non-Programming type maintainers?

              Also can you please offer some advice on what steps or changes you did to make the transistion? (or perhaps a couple of examples)

              Please assist if you can spare a little time to share your transition experience!

              Best Regards,
              Andy

                I did a major rewrite.... i used smarty templating engine instead of FastTemplate,... my advice, ... use Smarty instead. http://www.php.net

                  Gee! Was it a major task (did it take long?)

                  I was hoping you wouldn't say that but I guess it must have been for the better.

                  Is it because some of the functions are no longer supported and have been dropped I wonder?

                  Or is it a case of PHP turning into an OpenMicrosoft type situation where we either get with the new or we get lost..lol?

                  I know its an old dog the FastTemplate, but doing a major re-write would totally Fry My Head, as one of my sites is Huge with regards to how much code there is for me to handle! 🙁

                  Anyways, thanks for letting us know all the same!
                  😃

                  Cheers

                    Hi,

                    I don't know if this helps you but it could be an acceptable task to search through the directory and replace include by include_once and require by require_once in the files if you do that with an editor that supports search and replace in files.

                      Well, .. i worked on the code for 8 hours straight....

                      there's nothing you can do about it... FastTemplate has some method's in its class declarations that are meant to be overloading one another.. but? like what they've said.. this feature is actually a bug..PHP doesn't support overloading even in the new PHP version 5... i dont directly support overloading.. so better use Smarty .. u'll get a better code base since this templating engine is being supported by PHP developers...

                        Write a Reply...