I need to run composer update at my hosting so I log in with ssh and try to run comand:
inside /www folder where I have laravel and composer instalation
in contact with my hosting provider they tell me to run command:
php -d memory_limit=512M composer update
I run this command but I get: “Could not open file: composer”
What to do? What is the soluton here?
When you run
composer update, the OS will look into the configured paths and try to locate an executable file with that name.
php composer update, the
composer string is treated as a parameter to PHP, which is not searched in any paths. You have to provide the full path in order to run it.
which composer will tell you where the OS finds the composer executable, and then you simply use the full path in the PHP command:
$>which composer /usr/local/bin/composer $>php -d memory_limit=512M /usr/local/bin/composer update ...
Note that 512MB might be too few. My perception is that it will happily take 1GB or more, depending on the number of dependencies you use and the variety of versions that you theoretically allow, i.e. if you allow Symfony
~2.3, then you make Composer deal with a lot more possible versions compared to using
Also note that running Composer on the production machine is not the best idea. You would have to have access to Github, maybe provide access credentials, have VCS tools installed, and you will easily break your site if any of the remote hosting servers is offline during your update. It is a better idea to use Composer on a deployment system that does all the preparation, and then moves all the files onto the production server.