When composer update
launched, the OS will look into the configured paths and try to find an executable file with this name.
When running php composer update
string composer
considered as a parameter for PHP, which is not performed by searches on any paths. You must provide the full path to run it.
Running which composer
will tell you where the OS finds the composer's executable, and then you just use the full path in the PHP command:
$>which composer /usr/local/bin/composer $>php -d memory_limit=512M /usr/local/bin/composer update ...
Please note that 512 MB may be too small. My opinion is that it will gladly take 1 GB or more, depending on the number of dependencies you use and the variety of versions that you theoretically allow, i.e. if you enable Symfony ~2.3
, then you make Composer more versions than using ~2.7
.
Also note that running Composer on a production machine is not a good idea. You should have access to Github, perhaps provide access credentials, install VCS tools, and you can easily break your site if any of the remote hosting servers are down during your upgrade. It is best to use Composer in a deployment system that does all the preparation and then moves all the files to the production server.
source share