0

Im trying to install composer on my production machine but keep getting many errors.

Im following the tutorial on this site

https://linuxize.com/post/how-to-install-and-use-composer-on-ubuntu-18-04/ to install.

But when i run this command

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

I get the following error.

enter image description here

I removed the old installation because everytime I tried composer update I also got a memory error. So Im trying to update composer and now my machine cant even install composer.

My VPS has

  • I have 1 cpu
  • 50Gig HDD
  • 2 Gig ram

2 Answers2

2

This is a list of common pitfalls on using Composer and how to avoid them.

Memory limit errors

Composer may sometimes fail on some commands with this message:

PHP Fatal error:  Allowed memory size of XXXXXX bytes exhausted <...>

In this case, the PHP memory_limit should be increased.

Note: Composer internally increases the memory_limit to 1.5G.

To get the current memory_limit value, run:

php -r "echo ini_get('memory_limit').PHP_EOL;"

Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems):

; Use -1 for unlimited or define an explicit value like 2G
memory_limit = -1

Composer also respects a memory limit defined by the COMPOSER_MEMORY_LIMIT environment variable:

COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>

Or, you can increase the limit with a command-line argument:

php -d memory_limit=-1 composer.phar <...>

This issue can also happen on cPanel instances, when the shell fork bomb protection is activated. For more information, see the documentation of the fork bomb feature on the cPanel site.

source: Troubleshooting - Composer

karel
  • 114,770
Johan Palych
  • 1,361
  • 8
  • 9
0

AptGet Howto

sudo su
dpkg -l| grep -v 'ii'| less
rc - means that the package was deleted, but the configuration files remained
ic - means that the package is installed, but no configuration files are configured

dpkg --audit dpkg --get-selections | grep hold

How can you unhold (remove a hold on) a package?

While there is no built in way to remove all of your configuration information from your removed packages you can remove all configuration data from every removed package with the following command.
dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge
Johan Palych
  • 1,361
  • 8
  • 9