wp-cli installation

时间:2015-08-24 作者:Christophe

我安装了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
我有点糊涂了。我哪里做错了?

1 个回复
SO网友:Christophe

我在php中发现了错误。已使用ini。在我的。zshrc文件我将php的版本更改为良好的版本(5.5.10),现在是wp。cli工作正常。

结束

相关推荐

如何使用$_POST创建WP-CLI命令?

我想为创建WP-CLI命令WordPress Database Reset plugin.在main function 它对选项使用$\\u POST,但在cli中运行命令时,这些选项将不存在。应该如何创建cli命令?我看到了commands cookbook.function wp_reset_init() { global $wpdb, $current_user, $pagenow; // Grab the WordPress database tables