skip to Main Content

I am trying to install composer to my cPanel but I can not getting error.

I have used this command to install it.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

and

php -r "readfile('https://getcomposer.org/installer');" | php -c php.ini

But both command is not working for me.

Getting this error

Error in argument 1, char 2: Option not found r

2

Answers


  1. You can try:

    curl https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer | php -- --install-dir=bin --filename=composer
    

    got it from https://docs.cpanel.net/knowledge-base/web-services/how-to-set-up-php-composer/

    or

    wget 'https://getcomposer.org/installer -O composer-installer.php
    
    php ./composer-installer.php --install-dir=/usr/local/bin --filename=composer
    

    got from: https://computingforgeeks.com/how-to-install-php-composer-on-cpanel/

    Login or Signup to reply.
  2. Maybe you’re disallowed using -r option which evaluates php code. Try to use wget instead.

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

    Make it executable.

    chmod +x ./composer.phar 
    

    Move to bin for global usage

    mv ./composer.phar /usr/bin/composer
    

    Of course I don’t know if this is possible in your cpanel installation.

    References: 1

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search