1

i installed 0h-my-zsh; then wp-cli, change .zshrc file and wrote :

# FIX PHP MAMP for WP-CLI
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH
export PATH=$PATH:/Applications/MAMP/Library/bin/

because of mamp ( which i use ).

Then move to a WordPress directory and try to install a plugin :

wp plugin install *name-of-the-plugin*.

but i've got an error message :

Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in
/Applications/MAMP/htdocs/Wp theme dev/wp-includes/wp-db.php on line 1452
Deprecated: mysql_connect(): The mysql extension is deprecated and will be     
removed in the future: use mysqli or PDO instead in /Applications/MAMP/htdocs/Wp   
theme dev/wp-includes/wp-db.php on line 1482
Warning: mysql_connect(): No such file or directory in 
/Applications/MAMP/htdocs/Wp theme dev/wp-includes/wp-db.php on line 1482
Error:
<h1>Error establishing a database connection</h1>
<p>This either means that the username and password information in your   
<code>wp-config.php</code> file is incorrect or we can't contact the database  
server at <code>localhost</code>. This could mean your host's database server is  
down.</p>
<ul>
<li>Are you sure you have the correct username and password?</li>
<li>Are you sure that you have typed the correct hostname?</li>
<li>Are you sure that the database server is running?</li>
</ul>
<p>If you're unsure what these terms mean you should probably contact your host.  
If you still need help you can always visit the <a  
href='https://wordpress.org/support/'>WordPress Support Forums</a>.</p>

i typed

echo $PATH 

and here is the result :

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

then,

wp --info :

PHP binary: /usr/bin/php
PHP version:    5.5.27
php.ini used:
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.19.2

i'm a little bit confuse. where did i make wrong ?

1 Answer 1

1

I found my error in the php.ini used. In my .zshrc file i change the version of php to the good one (5.5.10 ) and now wp.cli works fine.

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.