• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

GridPane

  • How it Works
    • Creating Servers
    • Creating Websites
  • Use Cases
  • Pricing
  • Knowledge Base
  • More
    • FAQ
    • Apollo
    • Comparisons
    • Updates
  • Login
  • Free Trial
GridPane >Knowledge Base > Setting the CLI PHP Version

Setting the CLI PHP Version

Steve B
Updated on 4th January 2021

2 min read

Out of the box, our default CLI PHP setting is 7.3, soon to be updated to 7.4 out of the box. However, on some older servers, this may still be set to the default of PHP 7.2.

Some programs (such as Composer for example) require a higher version of CLI than the default 7.2 version which may require you to update this to a higher version.

Here’s an example of this error from a site where SSO was failing to generate a login link:

Your Composer dependencies require a PHP version “>= 7.3.0”. You are running 7.2.25-1+ubuntu18.04.1+deb.sury.org+1. Error Code: 100 | PHP Errors stopping SSO Link creation, please check logs….

Here Composer is using the CLI PHP version, and not the FPM one that is used by sites. Switching the PHP version of your sites will not fix this specific issue as this only changes the PHP version for FPM.

This is a quick and easy fix though.

Updating the CLI PHP Version

To run this update you will need to SSH into your server. Please see the following guides to get started:

Generate your SSH Key:

Generate SSH Key on Mac

Generate SSH Key on Windows with Putty

Generate SSH Key on Windows with Windows Subsystem for Linux

Generate SSH Key on Windows with Windows CMD/PowerShell

Add your SSH Key to GridPane:

Add default SSH Keys

Add/Remove an SSH Key to/from an Active GridPane Server

Connect to your server:

Connect to a GridPane server by SSH as Root user.

Checking your CLI PHP Version

To check your CLI PHP version, you can run the following command:

sudo update-alternatives --display php

This will output the following, only with the correct PHP version should your setting be different:

root@servername:~# sudo update-alternatives --display php
php - auto mode
link best version is /usr/bin/php7.3
link currently points to /usr/bin/php7.3
link php is /usr/bin/php
slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php7.3 - priority 73
slave php.1.gz: /usr/share/man/man1/php7.3.1.gz
root@servername:~#

Changing your CLI PHP Version

Next, you need to run the following command to change the CLI version:

sudo update-alternatives --set php /usr/bin/php7.X

X = the version number, which could be 1,2,3,4.

For example:

sudo update-alternatives --set php /usr/bin/php7.3

Once done, you’re all set!

Primary Sidebar

Search the Knowledge Base

  • Provisioning Servers
  • Managing Servers
  • Managing Websites
  • SSL Certificates
  • Server Caching
  • Migrating to GridPane
  • Plugins / Services
  • Security
  • Performance
  • SMTP / Email
  • FAQ
  • Policies

Footer

Quick Links
  • Documentation
  • Status
  • Roadmap
  • Comparisons
  • Updates
  • Facebook Group
Connect With Us
  • (619) 4-SERVER
  • info@gridpane.com
Facebook-f
Twitter
Youtube

GridPane is the world’s first hosting control panel purpose-built for Serious WordPress Practitioners

© Copyright 2017-2021 – GridPane – Run WordPress the Right Way

Terms of Service – Privacy Policy – GDPR
Built with ❤ by S Bell
  • How it Works
    • Creating Servers
    • Creating Websites
  • Use Cases
  • Pricing
  • Knowledge Base
  • More
    • FAQ
    • Apollo
    • Comparisons
    • Updates
  • Login
  • Free Trial