3

I wanted to test N98-magerun on my local Mac, using MAMP. I get a lot of errors, for example:

"cache:list" results in:
[Zend_Db_Adapter_Exception]
SQLSTATE[HY000] [2002] No such file or directory
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory

"open-browser 2" results in the above message, plus this one:
The command terminated with an error status (2002)

"database:info" results in:
[InvalidArgumentException]
There are no commands defined in the "database" namespace. The command terminated with an error status (1)

What am I missing? I tried to google, but failed to find any useful info. Please help.

| improve this question | | | | |
  • john-jh's answer solved my issue. Thank you john-jh! – szabesz Jul 4 '14 at 10:56
5

N98 will be trying to use your Macs native PHP which isn't configured for MAMP's MySQL resulting in the database errors.

Change directory to /usr/bin

cd /usr/bin

Change the name of the native php to keep a backup (just incase)

sudo mv php php.old

Create a symlink to your php version

sudo ln -s /Applications/MAMP/bin/php/php.[VERSION]/bin/php php



Where '[VERSION]' is your php version so you're basically creating a symlink to the PHP version you're using in MAMP

| improve this answer | | | | |
4

I would suggest this method. Overriding the native php version might not be the best plan.

Update your .bash_profile with the following:

# Use MAMP version of PHP
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

# Export MAMP MySQL executables as functions
# Makes them usable from within shell scripts (unlike an alias)
mysql() {
    /Applications/MAMP/Library/bin/mysql "$@"
}
mysqladmin() {
    /Applications/MAMP/Library/bin/mysqladmin "$@"
}
export -f mysql
export -f mysqladmin

Solution taken from: http://www.endreywalder.com/blog/magenton98-magerunmamp/

Edit: You need to run source ~/.bash_profile each time you open a new Terminal, that's the only issue I have encountered.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.