user8814721
user8814721

Reputation:

How can I install composer in live server cpanel

I want to use php spreadsheet package and from their site, I was told to install composer on cpanel but have met little success on the internet trying to figure out how to do it.

Please, who can put me through on how to install composer on liveserver

Upvotes: 0

Views: 2038

Answers (1)

Ivan Denchev
Ivan Denchev

Reputation: 436

You can use SSH for this (alternatively using cron jobs to run the commands will also work - way more tedious)

Login to your cPanel account via SSH

Make directory for your composer (can also be used for other executables that you might store)

mkdir ~/composer
cd ~/composer

Download composer

wget https://getcomposer.org/download/1.6.5/composer.phar

Change the name of composer and make it executable

mv composer{.phar,}
chmod +x composer

You will now be able to call composer by

php ~/composer/composer install

But it's more convenient to have it run by just invoking composer in your terminal. For this add the ~/composer directory to your $PATH. I'm using VIM for text editing so

vim ~/.bashrc

Append those two lines at the bottom

PATH=~/composer:$PATH
export PATH

Exit and login via SSH again - you will be able to freely call composer in your terminal

Upvotes: 2

Related Questions