Jump to content

[Solved] After Moving Ps To New Domain Pages Can't Load Frontcontroller (Module Fc Loads Too Soon?)


jave.web

Recommended Posts

I just moved one shop from one domain to another, PHP version i similar, both are PHP 5.4.x,

I also configured everything in settings.inc.php as well as in database.

 

Shop on the testing domain is working perfectly fine.

 

I use FrontController override and also my module to display special pages.

 

But on the new domain, only special pages of my module, with they own controllers, display fine.

 

Index and every other "classic" front pages (like order) display this error:

Class 'FrontController' not found in /MYPATH/classes/controller/ModuleFrontController.php on line 31

...of course MYPATH is in reality some real server absolute path...

 

I checked the ModuleFrontController.php and it extends FrontController. Now the funny thing is that my module special pages controllers are actually extending class, that is extending the ModuleFrontController....

 

Another funny fact is that if I put "dummy" class FrontController before ModuleFrontController, I get error when my FrontController override is loaded - of course that I can't redefine FrontController... So it gets loaded but in some weird order...

 

So somewhere something is switching the order of loading the controllers.

 

Did this happen to anyone? Any ideas?

 

- also I remind you that on test domain everything works perfectly fine... 

 

---- thanks :(

 

PS: Also my FrontController override does not start exactly with FrontController class, there are some helpers before it .... coul that be a problem? But on test domain it works.... so why wouldn't it work here?

 

 

Edited by jave.web (see edit history)
Link to comment
Share on other sites

So I solved it. Very strange behaviour though.

 

My problem was caused by ANY PHP CODE before my FrontController override class.

 

It worked on my testing server, but on the "live" hosting server it did not. If I put ANY code before my FrontController class definition - front loading did not found it so it was not initialized.

 

So if you have e.g. .... 

 

<?php

include_once("some_cool_php_include.php");

class SomeDummyUsefulClass{
   //some code
}

//some other code
//some other code
//some other code

class FrontController extends FrontControllerCore {
    public function init(){   
        parent::init(); 
        //some other code
    }
    //some other code
}   

//some other code

You have to remove everything before class FrontController extends FrontControllerCore , except <?php ...of course. So your controller php file starts like:

 

<?php

class FrontController extends FrontControllerCore {
   //some other code

...nevertheless - what to do with you "before" code? => just put it AFTER your FrontController class definition... :-)

 

PS: Also I noticed that PHP option of output_buffering was On on my testing server and Off on the live server - it might have caused the problem, but I am not really sure about that... :-)

Edited by jave.web (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...