0

I've downloaded a website that uses CakePHP 1.3.16 and have a bunch of .yml files for database creation and setting up. When I perform:

$../cake/console/cake migrate

I get a MDB2 ERROR but without any further clue so it's very difficult for me to google for info about how to solve it. The error looks like this:

  __  __  _  _  __     ___     __   __   __  ___    __  _  _  __ 
 |   |__| |_/  |__    | | | | | _  |__| |__|  |  | |  | |\ | |__ 
 |__ |  | | \_ |__    | | | | |__| | \_ |  |  |  | |__| | \|  __|

 App : app
 Path: /home/coolia/Projects/cooltra/coolia/web/app


   ** Error: MDB2 ERROR **

  ---------------------------------------------------------------

I'm running ubuntu 14.04 with Apache and MySQL.

Does anyone know how to get more information about the error, via any log file or verbose option, or even better, how to solve it?

Lots of thanks in advance.

theme
  • 1,097
  • 2
  • 9
  • 13

1 Answers1

0

Finally I managed to get more useful information than just * Error: MDB2 ERROR *. To get more information I had to edit the migration script (for cakePHP version 1.3 it is /app/plugins/migrations/vendors/shells/migrate.php).

Once in it, check all the error messages and adding customized and easy to track text for the error messages I was able to find the line where the error was happening. The line was:

if (PEAR::isError($this->_db)) $this->error('MDB2 ERROR', $this->_db->getDebugInfo());

The "funny" thing is that the error log message is concatenated with a comma (,) which PHP seems to not understand and thus the error message log is lost and not shown. I just replaced the comma (,) with a dot (.) and I was able to see the error message. The line then stays as:

if (PEAR::isError($this->_db)) $this->error('MDB2 ERROR' . $this->_db->getDebugInfo());

Once the error message is printed out, solving the issue was very easy. The problem was that the user used to connect to database had no enough privileges to connect to it.

So, the main problem for me was to get relevant information about the error. To get more meaningful error message than MDB2 ERROR, edit your migration.php file to properly display error log messages.

Cheers!!!

theme
  • 1,097
  • 2
  • 9
  • 13