Our site worked fine on the old server, but we’ve recently moved it to a new server, and immediately, everything on the site looked messed up (ie can’t find the data it’s looking for in the views).
Upon further investigation, what was previously returned like this:
$articles[0]['Article']['title']
Is now returning:
$articles[0][0]['title']
At first, we were told it was that PDO wasn’t installed (or was corrupted or something), but we rerebuilt Apache with PDO over and over and it’s showing PDO on for both PHP and MySQL.
I’ve tried searching, but either I’m searching for the wrong thing, or there’s no good info out there. Any ideas what could be causing this and/or how we can fix it?
Edit:
It also worked on this server prior to an update, which updated it to 5.3 (not sure what the prev version was)
Edit 2
Per suggestion, I changed the datasource to HpMysql This makes it work. It doesn’t answer my question though, as I see it as a temporary fix – I’d still like to know what the issue is, and how to fix it without having to use this workaround.
Answer by Original Poster (me):
According to our server guy, “There are two ways to load PDO. The first is by using easyapache to install the PDO php extension. The second is by installing the PDO via PECL. It appears that the modules in question are different.”
Apparently, this server had PECL on it instead of the normal easyapache PDO. When he removed that, and restarted/reset it with the easyapache PDO, everything worked great.
So – sounds like CakePHP requires the “normal” PDO.
Mystery solved.
If you have PECL instead, you can use this workaround:
Create a file “HpMysql.php” in your Datasource folder and add this code/class: https://github.com/lorenzo/HipHop/blob/master/Model/Datasource/Database/HpMysql.php
Change your database.php ‘datasource’ to ‘HpMysql’
Different problem: (turned out to be the same answer):
$this->Auth->login() creates correct query that returns 1 row, but fails IF check (server specific issue)