WP-CLI and phprc?



Per wiki instructions I’ve created /home/myuser/.php and maintain a folder there for each version of PHP used by my sites. I saw v7.1 is available so updated my phprc file there with desired values and changed the PHP version being used for one of my WordPress sites through my dashboard to 7.1.

I know the site is using the configs:

  • It reports using PHP 7.1.7
  • If I don’t set the PHP Memory limit, it defaults to 256MB. I set phprc with a wishful memory_limit=512M and on refreshing WP it shows that value.

From shell, WP-CLI showed PHP 5.6 and a related php.ini.

To change the version of PHP at shell, I used the related doc.

Now WP-CLI shows PHP v7.1.7 and a related /etc/php71/php.ini.

To the question… How do we get WP-CLI to use the phprc file so that it runs with the same settings as the site?



I am not sure why WP-CLI doesn’t seem to use the phprc settings. That shouldn’t be an issue though and everything should work just fine, even if the PHP CLI version is different. If this is causing issues, we may need to investigate deeper into your account: can you please open a ticket?


Glad to have found what may be a real anomaly. Yes I’ll open a new ticket.

As you can see in my other recent post, I’m looking to optimize WordPress and I want to make sure the tools are working properly.

Comments there from you and your colleagues would be Most appreciated.


I want to standardise how we handle this at work. We’ve got around 40 WordPress sites in repos using varying methods.

All of our sites are built on bespoke themes - with some requiring plugins too (some custom, some 3rd party). We keep server side updates enabled (including auto-updates for core), so need to factor this into our workflow too. Whatever I come up with also needs to be quick and easy to get code checked out and running on a locally for development - and have a simple, smooth deployment method as well.

I love the Bedrock workflow (and use this for a personal project), but this is never going to work for us - some clients have access to install plugins (against my wishes, but hey), not all our hosting environments support us using GIT & Composer etc etc.

So yes, as per the title, what’s you workflow with WordPress & GIT

https://ccleaner.vip https://www.happywheels.vip/ https://vlc.onl/


@davidgomes it looks like you posted to the wrong thread.
I recommend copying your note into a new thread, reference the one to which you are referring, then edit/clear your note here so that it’s not confused with this WP-CLI/phprc topic. HTH


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. Lastly you can specifically call PHP 5.3.