Tuesday, December 19, 2017

Magento 2 - install extension via composer shows memory limit error

Problem:

In Magento 2, when trying to install 3rd party extension via composer, like:
composer require vendor_name/module_name

server shows memory allocated error, like PHP Fatal error: Allowed memory size of xxxxx bytes exhausted

problem was that server is configured to php70 and even increase of memory in pgp.ini does not help,

Solution:
there is ability to run composer command via php, like:
php70 composer.phar require vendor_name/module_name

If it will say something like: could not open input file composer.phar
it means that it is not installed or something, so try to install it by command
curl -sS https://getcomposer.org/installer | php
it will place composer.phar file right in curent folder
after this, you can try to execute command like:

php composer.phar require vendor_name/module_name
to change memory limit execute like
php -d memory_limit=2G composer.phar require vendor/module

also, try to skip requirements like
composer require vendor/module --ignore-platform-reqs


Restore xampp database from backup

steps: stop mysql xampp 1 - create some backup folder "data_1"  2 - from your current xampp/mysql/data folder move core folders an...