我安装了0h my zsh;然后wp cli,更改。zshrc文件并写入:
# FIX PHP MAMP for WP-CLI
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH
export PATH=$PATH:/Applications/MAMP/Library/bin/
因为mamp(我使用)。
然后移动到WordPress目录并尝试安装插件:
wp plugin install *name-of-the-plugin*.
但我收到一条错误消息:
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>
我打字了
echo $PATH
结果如下:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
然后,
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
我有点糊涂了。我哪里做错了?