For Laravel
Step 1. Open your terminal
step 2. cd
into your laravel directory
step 3. Type the command which composer
, in your laravel directory and note the directory in which composer resides.
step 4. run the command php -d memory_limit=-1 /opt/cpanel/bin/composer update
(you can also run the code if it works for you)
(change /opt/cpanel/bin/composer
to the directory path returned in step 3 )
Problem solved