0

I want to reload my project's custom classes in Laravel so they become accessible, but on a shared hosting enviroment. To my understanding, so far, locally, I've been achieving the desired by using this command:

composer dump-autoload

however, running that via putty's SSH gives me:

-bash: composer: command not found

Any idea?

Daniel Birowsky Popeski
  • 8,752
  • 12
  • 60
  • 125

7 Answers7

7

please try:

php composer.phar dump-autoload

Because composer is only avaialble when installed globally, into /usr/local/bin/composer path.

Hope that helps!

huglester
  • 116
  • 3
5

You have to install composer on the remote machine that your are ssh'ing to. You can find installation instructions on the composer homepage.

xiankai
  • 2,773
  • 3
  • 25
  • 31
Jarlskov
  • 144
  • 9
2

Try this command: # php-cli composer.phar --help

In some servers Composer should be invoked via the CLI

Pierre-Luc Pineault
  • 8,993
  • 6
  • 40
  • 55
Jackss
  • 21
  • 2
1

Try:

php composer.phar dump-autoload

or

php composer.phar update
Ronald Do
  • 26
  • 4
0

In webfaction is: php54 composer.phar dump-autoload

RamiroRS
  • 461
  • 3
  • 4
0

If you are running in a production environment make sure to run:

[path to composer.phar] dump-autoload --optimize

This will autoload ony the necessary classes and GREATLY increase performance of your Laravel app.

Elliot Fehr
  • 764
  • 6
  • 10
0

If you are working with shared hosting, you probably need to put the full path to your composer executable. So it was in my case. Following the recommendations in this answer SSH Shell commands not found (composer, npm), I managed to run composer from the bash script:

which composer // In remote machine manually

This command shows the path where composer is installed on the remote server. You can also see the path by doing:

echo $PATH // you can surely add it

If composer is not on the $PATH, You can add it, if shared hosting gives you enough privileges, or you can just run the command in your bash script by calling composer with the full path. In my case it was to run:

$/opt/cpanel/composer/bin/composer install
pedrozopayares
  • 2,856
  • 1
  • 13
  • 14