I have been spending some time with CakePHP today and in order to execute php through the terminal to get it to connect to XAMPP’s correct mysql port, I need to run terminal. The problem is if you execute plain old php in terminal like “php –info” or “which php” you’ll get a response from the default installation of PHP on your mac. You need to run PHP as if it’s being run on the XAMPP environment.
In order to do this, make sure you execute php from the bin directory of XAMPP.
This way, your terminal application is executing PHP with the correct settings to do all the things it needs to do to connect to its version of mysql and write the correct files in your XAMPP environment (when you’re “baking” with cakePHP).