You will need your account’s SSH user to have /bin/bash access for the following setup. Consult with your shared hosting provider and make sure that your SSH user has /bin/bash access.
If you have administrator access to the server you can enable SSH access for an account if you go to Domains > example.com > Web Hosting Access and set option Access to the server over SSH to /bin/bash > OK to apply the changes.
SSH to the server with the username and the password of your account’s system user (primary FTP user) and perform the following steps.
Create the necessary files in your home directory if they are not present.
~/.bash_profile file with
vim or your favorite editor and add the following
Setup the desired PHP version
Plesk is using the pattern
/opt/plesk/php/X.X/bin/php for storing the PHP binary paths. So, we will need to adjust the PHP version and create an alias for the php command in our
~/.bashrc file and add the following
If you want to use a custom
php.inifile for the
phpcommand and not the global one you can create the file in your home directory and use it in the alias like
alias php='/opt/plesk/php/7.4/bin/php -c ~/custom_php.ini
Download and setup WP-CLI
Download WP-CLI to your home directory
Make it excecutable
Add the alias for the
wp command in your
~/.bashrc file, you can adjust the PHP version as you wish
You will need to log out and log in again to test the changes.