Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm facing the same problem, checked PDO support the same way, same result.</p> <p>The following script (that I wrote) might help to make sure our settings are ok:</p> <pre class="lang-php prettyprint-override"><code>&lt;?php include("../new-project/app/Config/database.php"); $config= new DATABASE_CONFIG(); $name = 'default'; $settings=$config-&gt;{$name}; $dsn = 'mysql:dbname='.$settings['database'].';host='.$settings['host']; $user = $settings['login']; $password = $settings['password']; try { $dbh = new PDO($dsn, $user, $password); echo "Connection succeeded with dsn: ". $dsn . "\n"; $sql = 'SELECT id, title FROM posts'; echo "Here is the contents of the table `posts:"; foreach ($dbh-&gt;query($sql) as $row) { print $row['id'] . "\t" . $row['title'] . "\n"; } } catch (PDOException $e) { echo 'PDO error: ' . $e-&gt;getMessage(); } ?&gt; </code></pre> <p>And it works fine :</p> <pre class="lang-none prettyprint-override"><code>mich@dennet:~/www/learn/cakePHP/tools$ php test-pdo.php Connection succeeded with dsn: mysql:dbname=test;host=localhost Here is the contents of the table `posts:1 The title 3 Title strikes back 4 Once again is back </code></pre> <p>FYI, here are version details :</p> <pre class="lang-none prettyprint-override"><code>mich@dennet:~/www/learn/cakePHP/tools$ php --version PHP 5.4.9-4ubuntu2.3 (cli) (built: Sep 4 2013 19:32:25) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.3.0dev, Copyright (c) 2002-2012, by Derick Rethans </code></pre> <p>Would it be a problem with paths ? Here's my bake interaction:</p> <pre class="lang-none prettyprint-override"><code>mich@dennet:~/www/learn/cakePHP/new-project$ /usr/local/bin/cake -app /home/mich/www/learn/cakePHP/new-project/app bake Welcome to CakePHP v2.4.1 Console --------------------------------------------------------------- App : app Path: /home/mich/www/learn/cakePHP/new-project/app/ ... What would you like to Bake? (D/M/V/C/P/F/T/Q) &gt; m --------------------------------------------------------------- Bake Model Path: /home/mich/www/learn/cakePHP/new-project/app/Model/ --------------------------------------------------------------- Use Database Config: (default/forbaking) [default] &gt; Error: Database connection "Mysql" is missing, or could not be created. #0 /usr/local/share/cakePHP/cakephp/lib/Cake/Model/Datasource/DboSource.php(262): Mysql-&gt;connect() #1 /usr/local/share/cakePHP/cakephp/lib/Cake/Model/ConnectionManager.php(107): DboSource-&gt;__construct(Array) #2 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(927): ConnectionManager::getDataSource('default') #3 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(864): ModelTask-&gt;getAllTables(NULL) #4 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(953): ModelTask-&gt;listAll(NULL) #5 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(205): ModelTask-&gt;getName() #6 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(93): ModelTask-&gt;_interactive() #7 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Command/BakeShell.php(111): ModelTask-&gt;execute() #8 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/Shell.php(435): BakeShell-&gt;main() #9 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/ShellDispatcher.php(210): Shell-&gt;runCommand(NULL, Array) #10 /usr/local/share/cakePHP/cakephp/lib/Cake/Console/ShellDispatcher.php(68): ShellDispatcher-&gt;dispatch() #11 /usr/local/share/cakePHP/cakephp/app/Console/cake.php(37): ShellDispatcher::run(Array) #12 {main} </code></pre> <p>I also tried :</p> <pre><code>mich@dennet:/usr/local/share/cakePHP/cakephp$ app/Console/cake bake </code></pre> <p>with no more success.</p> <p>Now I suspect the Datasource itself ...</p> <p>HTH</p> <p>Michelle</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload