“Class ‘Phar’ not found” error setting up WP-CLI with Cygwin

You are missing the Phar extension or it’s not enabled. Which version of PHP are you actually running? Check it with php –version. The Phar extension is bundled with PHP as of PHP version 5.3.0, and enabled by default. See https://www.php.net/manual/en/phar.installation.php. Your best bet is to upgrade PHP to at least PHP 7.1. Alternatively follow … Read more

Shortest way to install WP-CLI

Downloading the Phar file is the recommended installation method for most users. As you showed, it’s basically just one line. It can’t really get shorter than that. And the steps make sense: download the file, make it executable and move it to the right location. There are alternative ways to install WP-CLI though. For example, … Read more

MAMP PRO WP-CLI Error: Error establishing a database connection

I noticed a typo in the original answer, but it did work for me in my .zshrc file. The typo was the end of the last line, it was missing the final / between the php version and bin directory #MAMP Madness export PATH=/Applications/MAMP/Library/bin:$PATH PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

wp-cli: wp term generate xxxxx – Error: ‘xxxxx’ is not a registered taxonomy

I figured out a way, although it feels a bit wrong. First test if the taxonomy exists (which it doesn’t… the first time at least), and then create it as part of the process… if (! taxonomy_exists($this->taxonomy_manufacturer)) { register_taxonomy($this->taxonomy_manufacturer, ‘product’); } if (! term_exists($manufacturer[‘name’], $this->taxonomy_manufacturer)) { wp_insert_term($manufacturer[‘name’], $this->taxonomy_manufacturer); } Caveat, register_taxonomy warns of impending doom … Read more

WP-CLI sudden empty response

I’ve run into the same problem. It worked on Saturday. This Monday it auto-upgraded to 7.0.10, now it breaks. I don’t have a fix, so here’s more information that MAY help debugging? I’m on CentOS7 with cPanel’s EA brand of PHP. PHP 7.0.10 (cgi-fcgi) (built: Aug 22 2016 20:34:53) Copyright (c) 1997-2016 The PHP Group … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)