Friday, September 25, 2009

Re: MAMP + CakePHP issues

On 1 I second the opinion that vhosts are the way to go. I have never
ever ever bothered modifying htaccess files just to get a few apps to
run under localhost/one, /two and so on. You are on a Mac and in
perfect position to setup in a way that is 100% identical to a
production deployment. You need two things. vhosts in the apache conf
and fake hostnames for each vhost.
There might be a gui but I just edit the file /etc/hosts adding fake
names pointing to 127.0.0.1
127.0.0.1 one.site
127.0.0.1 two.site
...
That is very convenient.

Managing vhosts were mentioned by Frederick. An alternative is to pay
for MAMP pro which has built-in support for vhosts and "advanced"
features. Personally I use Apples supplied Apache and PHP and install
MySQL as a pkg so I have no details to offer on vhosts in MAMP.

Speaking of MySQL. Your second problem might be caused by differing
versions of MySQL if the errors apply only to certain queries. If they
are advanced as you say then they might require a more up-to-date
version than MAMP has. Either that or the version of Cake.

And when reading the backtrace, the top line is closest to the error.
Cake is born in webroot and looking at the error MySQL has problems
interpreting __getUsersForUsers as a SQL syntax... which I can
understand. That indicates to me that your version of Cake might be
the problem. It looks like a bug in your code but if you are sure the
same code is executed without problem on another install then it may
be a version problem.

/Martin

On Sep 25, 3:58 pm, FrederickD <manzanillo.engl...@gmail.com> wrote:
> Hi Fahd!
>
> I can advise you on the first question, but not the second. I had been
> using MAMP but decided to take it off and go with a stock approach. It
> took a little bit, but works solidly now. What makes it very easy is
> to use a cheap product called VirtualHostX. You can find it athttp://www.macupdate.com/info.php/id/25689/virtualhostx. The price
> recently went up it appears, but it is so worth it to not be
> frustrated while developing multiple sites. VirtualHostX is MAMP-
> friendly.
>
> I use it to have a sandbox site where I'm testing code and integration
> before moving that code over to the development site. Both can be up
> at the same time, obviously with different databases, but it could be
> the same one. Hmmm...
>
> Anyway, I am also using a product called ModelBaker fromhttp://widgetpress.com
> that also is MAMP-friendly and removes the need to use a command line
> when baking. All the database design is visual and the configuration
> of Cake is a snap. It is a RAP (rapid application prototype) tool that
> does a great job at generating 80% of the Cake code so you can focus
> on the 20% that is unique to your application. Plus it can generate an
> iPhone-aware web application. That's like getting a two-for-one deal!
> Very promising product.
>
> I hope some of this helps.
>
> On Sep 24, 3:10 pm, fahd <fahd...@gmail.com> wrote:
>
>
>
> > Hey fellow Cakers,
>
> > I've been developing on CakePHP for a bit and decided to have a
> > localhost version on MAMP so that I could demo my app to people
> > without being dependent on an Internet connection.
>
> > Ran into a few issues ofcourse and hoping someone can give some
> > insight:
>
> > 1) I have several sites under the /Sites/ folder and I pointed MAMP's
> > Apache document root there. For example /Sites/project1/ is where the
> > Cake app sites.  It finds the /project1/ site fine (after some
> > htaccess mods) but there are issues with relative links. Any link that
> > is manually coded and not using $html->link uses /Sites/ instead of /
> > Sites/project1/ as the base. This is for images and any Ajax calls
> > from jQuery. (css and js files are fine). The images I can bare, but
> > the site is unusable without Ajax.
>
> > Temp solution: changed the document root to /Sites/project1/. This is
> > not ideal, but I'd like to know if you guys have a fix so I don't have
> > to change the document root all the time for previewing different
> > projects.
>
> > 2) We have a lot of complex MySQL queries being made, using $this->query('SELECT...'). We've placed these in the appropriate models
>
> > within a function. Hence from the Controller we'll have something like
> > $this->Users->getMeSomething($variable), that goes to the user.php
> > model and runs that function. This works fine on our live and dev
> > sites, but for some reason on MAMP I'm getting the error:
>
> > Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> > check the manual that corresponds to your MySQL server version for the
> > right syntax to use near '__getUsersForUsers' at line 1 [CORE/cake/
> > libs/model/datasources/dbo_source.php, line 525]
>
> > The context:
> > ======
> > DboSource::showQuery() - CORE/cake/libs/model/datasources/
> > dbo_source.php, line 525
> > DboSource::execute() - CORE/cake/libs/model/datasources/
> > dbo_source.php, line 201
> > DboSource::fetchAll() - CORE/cake/libs/model/datasources/
> > dbo_source.php, line 336
> > DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
> > line 297
> > Model::call__() - CORE/cake/libs/model/model.php, line 441
> > Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
> > AppModel::__getUsersForUsers() - [internal], line ??
> > UsersController::view() - APP/controllers/users_controller.php, line
> > 401
> > Object::dispatchMethod() - CORE/cake/libs/object.php, line 118
> > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227
> > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
> > [main] - APP/webroot/index.php, line 88
> > ======
> > Line 88 on webroot is this: $Dispatcher->dispatch($url);
>
> > Thanks for any help
>
> > Fahd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: