I baked an application using console and from URL everything seems ok. But when i want to bake a model inside the application folder, I get an error:
Error: Database connection "Mysql" is missing, or could not be created.
#0 /opt/lampp/cake/lib/Cake/Model/ConnectionManager.php(98): DboSource->__construct(Array)
#1 /opt/lampp/cake/lib/Cake/Console/Command/Task/ModelTask.php(837): ConnectionManager::getDataSource('default')
#2 /opt/lampp/cake/lib/Cake/Console/Command/Task/ModelTask.php(782): ModelTask->getAllTables(NULL)
#3 /opt/lampp/cake/lib/Cake/Console/Command/Task/ModelTask.php(863): ModelTask->listAll(NULL)
#4 /opt/lampp/cake/lib/Cake/Console/Command/Task/ModelTask.php(186): ModelTask->getName()
#5 /opt/lampp/cake/lib/Cake/Console/Command/Task/ModelTask.php(84): ModelTask->_interactive()
#6 /opt/lampp/cake/lib/Cake/Console/Command/BakeShell.php(102): ModelTask->execute()
#7 /opt/lampp/cake/lib/Cake/Console/Shell.php(375): BakeShell->main()
#8 /opt/lampp/cake/lib/Cake/Console/ShellDispatcher.php(177): Shell->runCommand(NULL, Array)
#9 /opt/lampp/cake/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#10 /opt/lampp/cake/lib/Cake/Console/cake.php(24): ShellDispatcher::run(Array)
#11 {main}
This is what I have in my opt/lampp/htdocs/cakapp/Confg/database.php
<?php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => '127.0.0.1',
'login' => 'root',
'password' => 'alpha',
'database' => 'cakedb',
);
}
my php --ini return:
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/pdo.ini
while phpinfo() give me this path:
Configuration File (php.ini) Path: /opt/lampp/etc
Loaded Configuration File :/opt/lampp/etc/php.ini
Isnt there a contradiction in the above two outputs? I mean php --ini is supposed to outputting the php.ini of the xampp not the other one, how can i make it point at the xampp's php.ini? I tried to change it by changing .bashrc with this line, no help ofcourse
export PATH=/opt/lampp/bin:$PATH
I tried to add this line to the database.configuration file: 'port' => '/opt/lampp/var/mysql/mysql.sock' But it didnt help.
I did find some similar problems but they are either for windows for mac osx nothing for ubuntu.