Search code examples
command-lineplesk

How to open bashrc file from plesk server and add a new PHP PATH VERSION


I want to open my .bashrc file and and add a new PATH PHP VERSION export PATH=/opt/plesk/php/7.1/bin:$PATH;

In my root ssh connection i made : ls -a and i saw .bashrc ! but how i could open the file and add my new path ?

Sorry i'm really not a king in terms of command lines

Thanks a lot in advance if someone could help


Solution

  • To open file in editor you can use the following command:

    vi ~/.bashrc
    

    Or you can just add the line without opening file in editor:

    echo "export PATH=/opt/plesk/php/7.1/bin:$PATH;" >> ~/.bashrc
    

    After editing the file, run the following command (it will apply changes):

    source ~/.bashrc
    

    Also, make sure that a ~/.profile is there (sometimes it's missing). Otherwise, create it like this:

    echo '[[ -f ~/.bashrc ]] && source ~/.bashrc' > ~/.profile