• Resolved spinhead

    (@spinhead)


    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 to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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://make.www.ads-software.com/cli/handbook/installing/#using-a-custom-php-binary

    Thread Starter spinhead

    (@spinhead)

    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.

    Thread Starter spinhead

    (@spinhead)

    -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

    (@tylerthedude)

    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

    (@spinhead)

    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.

    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

    (@spinhead)

    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

    (@spinhead)

    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.