topher

Today I needed to use WP CLI to do a search and replace and found that they’re running 0.10.0-alpha, which doesn’t have search-replace in it.

No sweat, I downloaded wp-cli.phar and tried to run it, but it said

Fatal error: Class 'Phar' not found in /home/topher1/wp-cli.phar on line 3

because while I’m running 5.4 on my site, you get 5.2 on the command line.

I wanted to use at least 5.3, so here’s what I did:

First make sure you have the wp-cli.phar file in your home dir.

Secondly create this file: ~/.php/5.3/phprc and put this inside it:

extension=phar.so
detect_unicode = Off
phar.readonly = Off
phar.require_hash = Off
suhosin.executor.include.whitelist = phar

That tells PHP 5.3 to enable phar.

Lastly you can specifically call PHP 5.3 on the command line, like this:

/usr/local/bin/php-5.3 ~/wp-cli.phar --info

Then you’re all set.

Leave a Reply

Your email address will not be published.