How to change the PHP version used in CLI through SSH

January 4, 2024 / How-to Guide

This article provides instructions for changing the PHP version used in command line interface through SSH.

Follow the steps-

  1. Connect through SSH.
  2. If the file does not exit, create a “.profile” file-
    touch ~/.profile
  3. Modify the .profile file-
    nano ~/.profile
  4. Now, add this code to the file to select the required php version-
    export PATH=/opt/php7.4/bin:$PATH
  5. Load the .profile file-
    source ~/.profile
  6. Finally, Check the php version-
    php –v

In such a manner, you can change the PHP version used in the command line interface through SSH.

Also Read: How to change the PHP version for a website in Plesk

Dominos Search