Having problems using MAMP Pro, PHPStorm and Laravel?

Well, I just went through this and I have it solved.  I thought this might help someone else so, here is my "proactive" information share.  

I wanted to use MySQL for my DB and I was getting the error when trying to run: php artisan (or with the commanline tool below just 'artisan') migrate:install:

  [PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory

*meh* !  

What was happening was my command line was trying to run my native install, not MAMP Pro, but that's just the "gorey" details ;)

The answers are out there, but not specific to my environment and with the details all in one place :8}

Steps:

1) Create your project as a composer project.  I used the "Laravel/Laravel" one but I would think this would work for many others as well.

2) Install the Laravel plugin.  May not be absolutely necessary, but hey, help and extending is good ususally right?

3) Create a new Commanline tool for Artisan.  Link:  This was the most helpful article for me.

4) In your "<project>/app/config/database.php file, add this configuration to your file for mysql:

 
'mysql' => array(
   'driver'    => 'mysql',
   'host'      
=> 'localhost',
   'database'  
=> 'firstapp',
   'username'  
=> 'root',
   'password'  
=> 'root',
   
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
   'charset'   
=> 'utf8',
   'collation'
=> 'utf8_unicode_ci',
   'prefix'    
=> '',
),
  
All should work as advertised now :)
  
I wish you all the best and this is a "Thank you" for all the kind people who have helped me in this forum.
  
-John

Please sign in to leave a comment.