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




  • 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
    Sander de Snaijer

    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.

Please sign in to leave a comment.

Have more questions? Submit a request