Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install composer and wp-cli on cyon.ch hostings with SSH access.

Cyon.ch/Hostpoint - Install composer & wp-cli

SSH into your server and stay in the home directory of the user. Check if you have a bin directory in your user directory already, in case you do, omit the mkdir bin.

Use bin folder in $HOME for user scriptsr

For the commands to be loaded from the bin directory run echo "export PATH=$HOME/bin:$PATH" >> ~/.bashrc. For the new config to be used run source ~/.bashrc or close and reopen your SSH session.

Composer

Install composer using curl.

cd ~
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin
mv ~/bin/composer.phar ~/bin/composer
chmod u+x ~/bin/composer

If composer --version does not work then run echo "alias composer='~/bin/composer'" >> ~/.bash_profile. Then run source ~/.bash_profile or close and reopen your SSH session.

WP-CLI

Again SSH into your server, make sure you have a bin directory and type the following commands:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv wp-cli.phar ~/bin/wp
chmod u+x ~/bin/wp

If wp —-info does not work then run echo "alias wp='~/bin/wp'" >> ~/.bash_profile. Then run source ~/.bash_profile or close and reopen your SSH session.

WP-CLI Tab completion

mkdir ~/.wp-cli
cd ~/.wp-cli
curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
echo "source ~/.wp-cli/wp-completion.bash" >> ~/.bash_profile
source ~/.bash_profile

Now you have autocompletion of the wp-cli commands using wp <TAB><TAB>.

Self updates using cron jobs

To add these via SSH run crontab -e, type shift + A to edit and :wq to save.

WP CLI:

0	8	*	*	7	~/bin/wp cli update --yes > /dev/null

Composer

0	8	*	*	7	~/bin/composer self-update --quiet > /dev/null
@typoman76

This comment has been minimized.

Copy link

@typoman76 typoman76 commented Jul 27, 2016

thank you! helped me to install composer on cyon.ch

@neverything

This comment has been minimized.

Copy link
Owner Author

@neverything neverything commented Jan 18, 2017

@typoman76 glad it helped you, added the cronjob config too so composer will keep up to date.

@haze83

This comment has been minimized.

Copy link

@haze83 haze83 commented Jun 5, 2018

Nice tutorial! Worked like a charm on a Hostpoint server.
For those who also needs to run wp-cli and composer in a different php version edit ~/.bash_profile and add/change the aliases to something like this:

alias php71='/usr/local/php71/bin/php'
alias composer='php71 ~/bin/composer'
alias wp='php71 ~/bin/wp'

Then run source ~/.bash_profile or close and reopen your SSH session. Now you can run composer diagnose and wp --info to check your installation.

@florianziegler

This comment has been minimized.

Copy link

@florianziegler florianziegler commented Apr 2, 2019

Pretty handy! Thanks @neverything! :)

@natemate90

This comment has been minimized.

Copy link

@natemate90 natemate90 commented Jun 7, 2019

Thanks for sharing! Maybe obvious for others, but I needed to change the active shell settings from sh to bash in order to get this working on hostpoint

@florianziegler

This comment has been minimized.

Copy link

@florianziegler florianziegler commented Jun 14, 2019

Another tip, that might be useful for others using cyon: I had to add PATH="$HOME/bin:$PATH" to my ~/.bashrc file to access wp-cli remotely, as described in the handbook.

@neverything

This comment has been minimized.

Copy link
Owner Author

@neverything neverything commented Nov 22, 2019

@signsi

This comment has been minimized.

Copy link

@signsi signsi commented Jan 28, 2021

Hey Silvan! Sehr cool, merci för die zämefassig. Hed perfekt fonktioniert ond eröffnet secherlech vell wiiteri möglechkeite au be hostpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment