Reputation: 9286
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?
Upvotes: 0
Views: 30146
Reputation: 2986
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
Upvotes: 0
Reputation: 116
please try:
php composer.phar dump-autoload
Because composer
is only avaialble when installed globally, into /usr/local/bin/composer path.
Hope that helps!
Upvotes: 7
Reputation: 774
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.
Upvotes: 0
Reputation: 144
You have to install composer on the remote machine that your are ssh'ing to. You can find installation instructions on the composer homepage.
Upvotes: 5
Reputation: 21
Try this command: # php-cli composer.phar --help
In some servers Composer
should be invoked via the CLI
Upvotes: 2