I have problem running the bake commands. i think it is related to mysql but i didn\'t find any solution to this error on Stackoverflow.
This is my app.php
:
I think this is the best way:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
add this in your database config
First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
This should output the path to the default PHP install which comes preinstalled by Mac OS X, by default it has to be (Assuming you've not changed it before):
/usr/bin/php
Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at /Applications/MAMP/bin/php/php7.0.0/bin (MAMP 3.5)
To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable. Follow these simple steps:
Within the Terminal, run vim ~/.bash_profile
Type i
and then paste the following at the top of the file:
export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
Hit ESC, Type :wq
, and hit Enter
In Terminal, run source ~/.bash_profile
In Terminal, type in which php
again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.
In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).
I am a beginner and got this problem on CakePHP Tutorial with using MAMP on MAC.
First I found php in my MAMP with this command:
find /Applications/mampstack-7.1.21-0/ -type f -name php
This should output your directory…. In my case this was:
/Applications/mampstack-7.1.21-0//php/bin/php
Then I found .bash_profile
and opened it with this command:
touch ~/.bash_profile; open ~/.bash_profile
It will open it with TextEdit. Then in this file, I edited path to the one I got with the first command and deleted the extra path with sbin:
export PATH="/Applications/mampstack-7.1.21-0/php/bin/:$PATH"
In Terminal command:
grep php ~/.bash_profile
Then I closed all terminals and after that, it works for me.
Thanks a lot for the first comment, it was helpful to get to this solution.
can test that
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'laboiterose',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
],
Problem solved!! The only thing i should add is this line in .bash_profile to make it work:
export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH
Changing 'host' => 'localhost',
to 'host' => '127.0.0.1',
resolve the issue with Exception for me.
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => '127.0.0.1',
I'm running on the Ampps.