Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Using oil and MAMP on OS X Snow Leopard
  • I am following Phil's tutorial on NetTuts and am trying to get oil refine migrate to work but I keep getting an error. I've read the other posts I can find and none have helped me, but before I go too much into what the errors are, I have a query reference the use of oil and MAMP. The version of Apache that comes with MAMP is what I am using, therefore all my settings are configured there. If I use oil, will it use the settings from MAMP or will it revert to the settings in the version of Apache distributed with OS X?
  • I was following a tutorial as well and using Mac OSX 10.7 w/ MAMP. When I tried to run my first migration I would get:
    -> php oil refine migrate
    Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Applications/MAMP/htdocs/fuel_demo/fuel/core/classes/database/pdo/connection.php on 82
    

    I solved the problem by changing my development db.php to:
    <?php
    /**
     * The development database settings.
     */
    
    return array(
     'default' => array(
      'connection'  => array(
       'dsn'        => 'mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock;dbname=fuel_demo',
       'username'   => 'root',
       'password'   => 'root',
      ),
     ),
    );
    

    After this I could successfully run the oil migrate commands. Is there a more elegant solution than this, or will this be sufficient for development? Any pitfalls with this method? I can't find much online.
  • Normally, the location of the socket is set in your php.ini. The issue here is probably that PHP-Cli uses a different php.ini from the one Apache is using. It's typical of a MAMP setup and cause of lots of misery.
  • Ah, thanks for clearing that up. I really appreciate the work you guys are doing, and I'm enjoying learning fuel PHP. Thanks for the help!
  • It might be helpful to know that the error I get is:
    basicdesigns:blog me$ oil refine migrate
    Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Applications/MAMP/htdocs/blog/fuel/core/classes/database/pdo/connection.php on 82

    When I run oil generate ... it tells me everything has been created but when I check phpMyAdmin or mySQL from the command line, there are no tables in the database blog_example. Both my development and production db.php are set to point at the correct database with the correct username and password. Clearly I don't want to be editing core files, I assume. Also, based on the unix:///... I am wondering if oil is trying to use settings that are not from MAMP, is this a correct assumption? I am totally confused.com! Would I be better off ditching MAMP and manually setting up the Apache server on my machine? Also, not sure if relevant but MAMP is using PHP v5.3.6 yet when I do a php -v it tells me version 5.3.8 is running...
  • Okay, I found the answer to the problem. In the tutorial, the DB settings use localhost. Having set up the Virtual Host, I should have changed this configuration in db.php to reflect. Which in turn answers my first question, that oil seems to be using the settings from MAMP.
  • Was playing about with something this evening in oil for the first time and came across this problem with MAMP. PHP is installed on my mac at /usr/bin, so when you do "php oil migrate refine", for example, it uses the PHP installed on the Mac, instead of the one that comes with MAMP, which is what you want it to use. Running it this way instead worked for me: /Applications/MAMP/bin/php/php5.3.14/bin/php oil refine migrate
  • I recall some issues with using localhost on Mac, most people change it to something else (like mac.local or so). And officially you should, as per the RFC 'localhost' is not a valid fully qualified name (which requires at least one dot in it).
  • That is indeed one of the common issues with MAMP.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion