简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM