Reputation: 5836
I just created a new project with CakePHP according to the main page you get after configuring everything i'm all in the green even database connection.
i run this command:
octavius@octavius-VirtualBox:/opt/lampp/htdocs/acltutorial/cake/console$ ./cake bake all
and this happens:
Welcome to CakePHP v1.3.7 Console
---------------------------------------------------------------
App : app
Path: /opt/lampp/htdocs/acltutorial/app
---------------------------------------------------------------
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
Use Database Config: (default/test)
[default] >
PHP Fatal error: Call to undefined function mysql_query() in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Fatal error: Call to undefined function mysql_query() in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
I went into my php.ini file and added extension = 'mysql.so' and it still doesn't work. Anybody have any ideas?
PS: Doing table by table yields the same error
EDIT: After doing what dogmatic69 suggested i got these warnings:
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552
PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 558
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 558
PHP Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 566
Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 566
PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Your database does not have any tables.
Still doesn't work.
Upvotes: 2
Views: 3421
Reputation: 1134
This was running me crazy as well. I am on Ubuntu with XAMPP. Managed to fix it using 8vius' solution In the /app/config/database.php file
'port' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'
Upvotes: 0
Reputation: 5836
This wasn't a cake error, apparently I had to specify the port in the database.php file like so:
'port' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'
it couldn't connect to the database for baking, though it worked for the app itself, this fixed it.
Upvotes: 0
Reputation: 7575
undo the changes you have made and then do something like this
sudo apt-get install php5-mysql
sudo service apache2 restart
Upvotes: 4
Reputation: 6047
It's not CakePHP error for sure. This means that mysql library is not loaded. When you added the extension did you restart the server? run phpinfo() in a file and see if the mysql is loaded.
Upvotes: 0