Tuesday, January 18, 2011

CakePHP Bake mysql.connect Error Running XAMPP

I ran into the following error baking with CakePHP. I was trying to create the cake schema for ACL tables.


:$ ./cake schema create DbAcl

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/cake/libs/cache.php on line 570

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/cake/libs/cache.php on line 570


Welcome to CakePHP v1.3.6 Console
---------------------------------------------------------------
App : app
Path: /htdocs/app
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------

Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552

Warning: mysql_connect(): No such file or directory in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 558

Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 566

Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 671

Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 671

Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 671

Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /htdocs/cake/libs/model/datasources/dbo/dbo_mysql.php on line 671


The issue that I didn't realize quick enough was that the CakePHP script wasn't using my XAMPP's PHP executable. Another instance of PHP was being run since it was located in my $PATH.

This can be easily corrected by correcting your $PATH with a quick visit to vi.