Title: wp-cli: choose php version
Last modified: March 15, 2020

---

# wp-cli: choose php version

 *  Resolved [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/)
 * wp-cli over ssh from my MacOS in terminal.
 * Server php is 5.5.38
 * Change to the directory where my wp install is, php version is 7.2.22
 * While in that directory:
 * wp cli info
    PHP binary: /opt/cpanel/ea-php55/root/usr/bin/php PHP version: 5.5.38
   php.ini used: /opt/cpanel/ea-php55/root/etc/php.ini WP-CLI root dir: phar://wp-
   cli.phar WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-
   CLI version: 0.24.1
 * and any command returns the same error
 * wp plugin list
    Your server is running PHP version 5.5.38 but WordPress 5.3.2
   requires at least 5.6.20.
 * I’ve searched every way I know how and can’t find how to convince it to use 7.2.22.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwp-cli-choose-php-version%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Ryan](https://wordpress.org/support/users/rrhode/)
 * (@rrhode)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12544716)
 * You can often change the default PHP version your cPanel if your host has one.
   You should make sure to check the site health in WP admin under Tools > Site 
   Health to make sure you’ve enabled all the right modules and whatnot. You might
   want to ask your host to help if it’s too hard to figure out.
 * If that doesn’t work you might have to update the PATH variable or you can try
   to set the WP_CLI_PHP variable:
    [https://wordpress.stackexchange.com/a/244170](https://wordpress.stackexchange.com/a/244170)
   [https://make.wordpress.org/cli/handbook/installing/#using-a-custom-php-binary](https://make.wordpress.org/cli/handbook/installing/#using-a-custom-php-binary)
 *  Thread Starter [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12544943)
 * PHP version is fine in cPanel, and fine if I check the PHP version in terminal/
   ssh. Site Health is good.
 * If I run
 * export WP_CLI_PHP=/opt/php72/bin
 * I get no error, which should mean all is well. Then I immediately run
 * wp plugin list
 * and get back
 * Your server is running PHP version 5.5.38 but WordPress 5.3.2 requires at least
   5.6.20.
 * So wp-cli seems to be ignoring the version of php in my htaccess, the version
   the site is using, and ignoring the explicit command to use v7.2, and using ONLY
   the default version on the server.
 *  [Ryan](https://wordpress.org/support/users/rrhode/)
 * (@rrhode)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12546773)
 * What about this: [https://www.knownhost.com/wiki/control-panels/directadmin/wrong-php-version-detected-using-multiple-php-versions](https://www.knownhost.com/wiki/control-panels/directadmin/wrong-php-version-detected-using-multiple-php-versions)
 *  Thread Starter [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12546830)
 * -jailshell: /usr/bin/su: Permission denied
 * My server guy has a query in to his people. He’s never used wp-cli but he has
   resources to check with. If I need him to do something, he’ll gladly do it barring
   security issues. But at this point, we’re not even sure what he could change 
   to allow this to work.
 * Thanks for continuing to offer suggestions. I appreciate any help I can get.
 *  [Tyler](https://wordpress.org/support/users/tylerthedude/)
 * (@tylerthedude)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12548578)
 * Hi there,
 * Try creating a new PHP file and add the `phpinfo();` function to the file. Upload
   this to the root directory of the web server and open the file. What did this
   function call report back with regarding the PHP version? If it’s the PHP version
   5.5, then this is the same PHP configuration file that the WP-CLI is reading 
   from. You could also try deleting and reinstalling the WP-CLI and see if that
   helps. Typically, in the root directory of your web server you will find the “.
   wp-cli” directory. Delete this directory along with the wp-cli.phar from the 
   bin directory. After this is done, reinstall the WP-CLI again and see if it reads
   the correct PHP version.
 * You can see here that the WP-CLI is loading this php.ini file:
 * `php.ini used: /opt/cpanel/ea-php55/root/etc/php.ini`
 * What’s strange is that if you changed the PHP version in the cPanel it should
   delete this directory and replace it with the PHP version you switched to. You
   should reach out to your host and ask why this directory is sticking around even
   after you switched PHP versions.
 * Regards,
    Tyler
 *  Thread Starter [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12548659)
 * phpinfo() is disabled on the server, and with jailedshell I don’t have access
   outside my hosting directory, nor can I install anything on the server.
 * I will confirm with my guy about the php files for the old version. That’s a 
   good question.
 * Thank you.
 *  [Ryan](https://wordpress.org/support/users/rrhode/)
 * (@rrhode)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12548749)
 * Sounds like you may want to consider a new host. I personally really like FastComet
   and they have wp-cli built in from the start. Their support is usually great 
   as well.
 *  Thread Starter [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12548802)
 * A new host because they have tight security? I think not. I’ve been with them
   for over a decade and received the best customer service, not just of any hosting
   company, but of any business relationship, in my life.
 * But other technical suggestions are welcome 🙂
 *  Thread Starter [spinhead](https://wordpress.org/support/users/spinhead/)
 * (@spinhead)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12562768)
 * The host changed my account’s path to php and resolved this issue. I’m finding
   out if it’s something I should have been able to do (user error) or something
   they had to fix (misconfiguration.)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘wp-cli: choose php version’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [ssh](https://wordpress.org/support/topic-tag/ssh/)
 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [spinhead](https://wordpress.org/support/users/spinhead/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-choose-php-version/#post-12562768)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
