我无法使用WP CLI安装插件。任何帮助将不胜感激。
我正在Windows 10上使用MAMP运行本地WordPress网站。我正在Ubuntu终端上使用WP CLI,该WP CLI在Windows 10计算机上的VirtualBox上运行。
在Ubuntu终端中,当我尝试运行wp plugin install jetpack
时,出现以下错误消息:
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory
in /home/matt-j/windows-desktop/projects/wp-rest-api-with-js/wp-includes/wp-
db.php on line 1531
Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in
/home/matt-j/windows-desktop/projects/wp-rest-api-with-js/wp-includes/wp-
db.php on line 1531
Error: Error establishing a database connection. This either means that the
username and password information in your `wp-config.php` file is incorrect
or we can’t contact the database server at `localhost`. This could mean your
host’s database server is down.
答案 0 :(得分:0)
我无法使WP-CLI与Windows上的MAMP和Windows上VirtualBox上安装的Ubuntu一起使用。所以我改为:
/opt/lampp/etc/httpd.conf
并编辑httpd.conf
来将XAMPP的文档根目录更改为指向我的Windows目录,以便将DocumentRoot "/opt/lampp/htdocs"
和Directory "/opt/lampp/htdocs"
编辑为{{1} }”和DocumentRoot "/home/matt-j/windows-desktop/apfm/repos
(注意:Directory "/home/matt-j/windows-desktop/apfm/repos"
是Windows 10主机上我的桌面的别名。windows-desktop
文件中添加了以下代码: .profile
# Define path for XAMPP
XAMPP_PATH=/opt/lampp/bin:/opt/lampp/sbin
export PATH="$XAMPP_PATH:$PATH"
重新加载了.profile
文件。source ~/.profile
),并且可以成功运行WP CLI命令(例如~/windows-desktop/apfm/repos/mj_local_test_wp
)。我希望这对某人有帮助!