How to specify command line command "php" version for SSH user on the Plesk server?




  • Avatar
    Jari Koivisto

    I tried to add .bashrc file with php alias line, but it didn't do the trick for me.

    I had to add PATH to .bash_profile file:

    echo "PATH=/opt/plesk/php/7.1/bin:$PATH" >> ~/.bash_profile

    Log out and log in. After that php -v show version 7.1.*


  • Avatar
    Ivan Postnikov

    Hello @Jari, thank you for sharing your experience, it may be useful for other Pleskians.

    I have checked the instructions on a test server with CentOS 7 and Debian 9, the provided steps were sufficient. 

  • Avatar
    Unknown User

    Thanks Jari your solution helped!

  • Avatar
    Robert Perrett

    Didn't work for me, no matter what I tried (Centos 7).  Finally came across another post on stackexchange which did the trick.

    sudo env "PATH=/opt/plesk/php/7.2/bin:$PATH" wp-cli.....

    Yes I installed my own version of wp-cli because the one built in with plesk has issues with DB search/replace.

  • Avatar

    Hi all,

    I had a different version from the domaines>php settings and the ssh one. Thanks to your solution I have the same one now : 5.6 according to php -v.

    But when I run composer require league/oauth2-google to install oauth2, I get the following message:

    league/oauth2-client 2.4.1 requires php ^5.6|^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.

    Do you have any clue? It seems that the version used by composer is another one.



  • Avatar
    Ivan Postnikov

    Hello @Erwan,

    Please, check the instructions in the following article 

    As an example of using composer, you may check our article on how to install Laravel :

    # cd httpdocs/ && /opt/plesk/php/X.Y/bin/php /usr/lib64/plesk-9.0/composer.phar create-project laravel/laravel --prefer-dist

  • Avatar
    Jan Bludau

    solution for PHP 7.2

    echo "PATH=/opt/plesk/php/7.2/bin:$PATH" >> ~/.bash_profile

  • Avatar
    Alexandr Nikolaenko

    Hello @Jan Bludau,

    Thank you for the input. Such a way also takes place.

    Just for other Pleskians: do not forget to log out/login after "~/.bash_profile" file is edited.

Please sign in to leave a comment.

Have more questions? Submit a request