Tuesday, June 4, 2013

Re: Multiple CakePHP running on the same machine are mixing up their classes

I experienced this and it was due to a cache collision.

In core.php if you have the same cache prefix, your applications might
get a little mixed. Make sure each application has a unique $prefix in
core.php

https://github.com/cakephp/cakephp/blob/3aa189eb3a49abfb31cd1b25b32505d249e95044/app/Config/core.php#L323-324

On Mon, Jun 3, 2013 at 11:45 PM, Olivier Vernin <overnin@gmail.com> wrote:
> I have multiple cake applications (v2.0) running behind a prefock
> apache(2.2.17) on my developer machine (php 5.3). Each one is on a different
> virtual host (port 81 and 82). The applications may interact with each other
> via HTTP requests. Before using LAMPP, i didn't get any issue. For practical
> reason i switch to standalone apache & mysql.
>
> Since i switch to standalone install, the 2 applications are messing their
> classes. For example the http request to the first application
> (vusion-frontend) are handle by the correct webroot/index.php but then the
> classes loaded are sometimes the one from the other application
> (vusion-datatools). See below the error stack trace for more details, it
> starts with in the correct path /home/oliv/Development/vusion-frontend, then
> get a Dispatcher class is loaded from
> /home/oliv/Development/vusion-datatools (the second application) then get
> the ProgramController class from /home/oliv/Development/vusion-frontend,
> finally it goes back to load the class from
> /home/oliv/Development/vusion-datatools.
>
> The issue arise when doing alternative request on each site.
>
> #0
> /home/oliv/Development/vusion-datatools/lib/Cake/Model/Datasource/DboSource.php(436):
> PDOStatement->execute(Array)
> #1
> /home/oliv/Development/vusion-datatools/lib/Cake/Model/Datasource/DboSource.php(403):
> DboSource->_execute('SELECT `Group`....', Array)
> #2
> /home/oliv/Development/vusion-datatools/lib/Cake/Model/Datasource/DboSource.php(647):
> DboSource->execute('SELECT `Group`....', Array, Array)
> #3
> /home/oliv/Development/vusion-datatools/lib/Cake/Model/Datasource/DboSource.php(1040):
> DboSource->fetchAll('SELECT `Group`....', false)
> #4 /home/oliv/Development/vusion-datatools/lib/Cake/Model/Model.php(2484):
> DboSource->read(Object(Group), Array)
> #5
> /home/oliv/Development/vusion-datatools/lib/Cake/Model/Datasource/DboSource.php(575):
> Model->find('first', Array)
> #6 /home/oliv/Development/vusion-datatools/lib/Cake/Model/Model.php(720):
> DboSource->query('findById', Array, Object(Group))
> #7 /home/oliv/Development/vusion-datatools/app/Model/Group.php(45):
> Model->__call('findById', Array)
> #8 /home/oliv/Development/vusion-datatools/app/Model/Group.php(45):
> Group->findById('1')
> #9
> /home/oliv/Development/vusion-datatools/app/Controller/AppController.php(97):
> Group->hasSpecificJobAccess('1')
> #10
> /home/oliv/Development/vusion-frontend/app/Controller/ProgramsController.php(42):
> AppController->beforeFilter()
> #11
> /home/oliv/Development/vusion-datatools/lib/Cake/Controller/Controller.php(605):
> ProgramsController->beforeFilter()
> #12
> /home/oliv/Development/vusion-datatools/lib/Cake/Routing/Dispatcher.php(101):
> Controller->startupProcess()
> #13
> /home/oliv/Development/vusion-datatools/lib/Cake/Routing/Dispatcher.php(86):
> Dispatcher->_invoke(Object(ProgramsController), Object(CakeRequest),
> Object(CakeResponse))
> #14 /home/oliv/Development/vusion-frontend/app/webroot/index.php(96):
> Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
> #15 {main}
>
> I really don't have a clue where this is coming from... Shouldn't apache
> make sure that php is not messing up. Is it a preloaded apache client of one
> application that try to serve another application?? still i don't get how
> one application could call a class from another part of the file system.
>
> Olivier
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Simon Males

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: