title: There is already an active transaction error on PDO->beginTransaction()
body: <p>I have an app built on CakePHP. Have 4 environments for app - local, testing, acceptance and production.
  Suddenly on only one of them (of course it's production) I started getting problems with transactions.
  The error I get is:</p>
  
  <pre><code>There is already an active transaction
  #0 /.../lib/Cake/Model/Datasource/DboSource.php(2294): PDO-&gt;beginTransaction()
  #1 /.../lib/Cake/Model/Model.php(1749): DboSource-&gt;begin()
  #2 /.../app/Model/AppModel.php(499): Model-&gt;save(Array, true, Array)
  .....
  </code></pre>
  
  <p>MySQL versions and settings seem to be identically on all environments, maybe the only difference it's <em>max_connections</em>. Also recently we didn't have CakePHP framework update, and app code is the same on environments.</p>
  
  <p>Debug shows me that there are 2 BEGIN transactions call in a row during script execution, but as official MySQL doc says:</p>
  
  <blockquote>
    <p>Transactions cannot be nested. This is a consequence of the implicit
    commit performed for any current transaction when you issue a START
    TRANSACTION statement or one of its synonyms.</p>
  </blockquote>
  
  <p>so I suppose it should not be a problem, plus on all environments there are the same 2 BEGIN, and everything just works fine there.</p>
  
  <p>Something tells me that if everything is ok on 3 of 4 environments, the reason is in environment, but I have no idea what it can be, and google doesn't say to much about.</p>
  
  <p>What can be the reason, where I should look for?</p>