Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8326631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:49:28+00:00 2026-06-09T00:49:28+00:00

OSX machine running MAMP. CakePHP 2.2.1 installed and configured properly (meaning that I have

  • 0

OSX machine running MAMP. CakePHP 2.2.1 installed and configured properly (meaning that I have all green bars when I browse to the Index.php file, I have completed the Blogs tutorial and am working on my second app with which scaffolding is up and running). Now I am trying to Bake for the first time.

Per the cookbook (and others), I installed a fresh copy of cake into a directory (my users directory) and then put the path variable in my .bash_profile file
export PATH="$PATH:/Users/p_scott/cake221/app/Console"
after which I was able to go into Terminal, type cake and have the console come up. You can see that up to that point, I was invoking the console from the app directory.

I first tried running cake bake from the terminal using the -app parameter and designating the path to my practice apps. The first time I did this, I got the following

    Welcome to CakePHP v2.2.1 Console
    -------------
    App : app
    Path: /Applications/MAMP/htdocs/blog/app/
    ------------- 
    Interactive Bake Shell
    --------------- 
    [D]atabase Configuration
    [M]odel
    [V]iew
    [C]ontroller
    [P]roject
    [F]ixture
    [T]est case
    [Q]uit
    What would you like to Bake? (D/M/V/C/P/F/T/Q)
    > c
    -------------------- 
    Bake Controller
    Path: /Applications/MAMP/htdocs/blog/app/Controller/
    -------------------- 
    \Use Database Config: (default/test)
    [default] >

No matter what I put in for the database (if I leave it blank, it asks me again), but any answer gives me the following error:

    Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in    [/Users/p_scott/cake221/lib/Cake/Model/Datasource/Database/Mysql.php, line 149]

    Error: Database connection "SQLSTATE[HY000] [2002] No such file or directory" is missing, or could not be created.
    #0 /Users/p_scott/cake221/lib/Cake/Model/Datasource/DboSource.php(260): Mysql->connect()
    #1 /Users/p_scott/cake221/lib/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)
    #2 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ModelTask.php(906): ConnectionManager::getDataSource('default')
    #3 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(396): ModelTask->getAllTables('default')
    #4 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(419): ControllerTask->listAll(NULL)
    #5 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(136): ControllerTask->getName()
    #6 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(61): ControllerTask->_interactive()
    #7 /Users/p_scott/cake221/lib/Cake/Console/Command/BakeShell.php(113): ControllerTask->execute()
    #8 /Users/p_scott/cake221/lib/Cake/Console/Shell.php(393): BakeShell->main()
    #9 /Users/p_scott/cake221/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)
    #10 /Users/p_scott/cake221/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
    #11 /Users/p_scott/cake221/app/Console/cake.php(33): ShellDispatcher::run(Array)
    #12 {main}

Once I started getting this error, I tried navigating in terminal to the <cake install dir>/app/Console folder and the <different instance of cake install dir>/app/Console folder to try the console from within my app/s. I either get the same errors or it asks me different questions, like:

    What is the path to the project you want to bake?  
    [/Users/p_scott/myapp] > /Applications/MAMP/htdocs/history/app 
    What is the path to the directory layout you wish to copy?  
    [/Applications/MAMP/htdocs/history/lib/Cake/Console/Templates/skel] > 

PHP CLI is installed and it appears to be working

    PHP 5.3.8 (cli) (built: Dec  5 2011 21:24:09) 
    Copyright (c) 1997-2011 The PHP Group
     Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

My PDO support appears to be enabled. In terminal I typed:

    php --ri pdo
    PDO
    PDO support => enabled
    PDO drivers => mysql, sqlite, sqlite2

I don’t have a php.ini file in Apache (because I am on a Mac), but the one in the PHP 5.36 directory, I have the following extensions enabled:

    extension=imap.so
    extension=yaz.so
    extension=mcrypt.so
    extension=gettext.so
    extension=pgsql.so
    extension=pdo_pgsql.so
    extension=pdo_mysql.so

After taking a break, I found an article
(http://www.dereuromark.de/2011/10/31/freshly-baked-cake2-0-tips/) that talks about a change of console location in 2.0. I should try using it from that location (<cake installed dir>/lib/Cake/Console ). Once I tried this, I either got the questions about what layout I wanted to use or… ONCE, I was able to get the bake application to ask me to create a database configuration. I went through the steps and it pooped out this error at the end:

Fatal error: Class 'DATABASE_CONFIG' not found in /Applications/MAMP/htdocs/history/lib/Cake/Console/Command/Task/DbConfigTask.php on line 264

Which leads me to one more piece of info. This is my default DB configuration in the <cake installation dir>/history/app/Config/database.php file.

    class DATABASE_CONFIG {

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'cakeHistoryUser',
    'password' => 'cakeHistoryPassword',
    'database' => 'cake_history',
    'prefix' => '',
    //'encoding' => 'utf8',
   );

Before posting this question (and all of this information), I spend some quality time out here and it seems like most of my issues are or CLI related but I just don’t see where I need to change something and hours and hours later, I need some help.

Help me Obi Wan, you are my only hope

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:49:30+00:00Added an answer on June 9, 2026 at 12:49 am

    The problem is you are trying to interact with the database via the command line, however the PHP-CLI is a different install than the one proveided by MAMP so it doesn’t know about the database server.

    Try changing localhost to 127.0.0.1 in your app/Config/database.php file and that should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

RVM is installed on my machine (running Mac OSX 10.6.8), correctly and it runs
I am running Mac OSX 10.5.8. I recently installed a version of macports that
I'm running Mac OSX 10.6.4 and have installed RVM. Its been great so far,
I have the 4 node riak setup running on my os x machine. I
I'm trying to run a webapp/site on my machine, it's running on OSX 10.6.2
I'm writing in C for OSX, running on a 64-bit machine in 32-bit mode.
Im running Apache on OSX, installed it via ports. For some reason it takes
I have a mac osx As such I have the normal python that comes
On Mac OSX 5.8 I have a Java program that runs at 100% CPU
I have to run top in my machine (mac osx), and get the cpu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.