I try to install payment module from GitHub.


When I run first command:

composer require dotpay/magento2-payment

Then I get error:

Using version ^1.0 for dotpay/magento2-payment

    ./composer.json has been updated
    Loading composer repositorUpdating dependencies (including require-dev)                                                                                                                      
    mmap() failed: [12] Cannot allocate memory

    mmap() failed: [12] Cannot allocate memory
    PHP Fatal error:  Out of memory (allocated 553656320) (tried to allocate 4096 by                                                                                                             tes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.ph                                                                                                             p on line 220

    Fatal error: Out of memory (allocated 553656320) (tried to allocate 4096 bytes)                                                                                                              in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on                                                                                                              line 220

Anyone know how to solve it?

EDIT: In php.ini I increased memory_limit to 2GB and 3GB. enter image description here

Then I restart apache server (debian 9): enter image description here

again try to install and still error: enter image description here


fsg@gerris:~/domains/aron.pl/public_html$ which php


fsg@gerris:~/domains/aron.pl/public_html$ which composer


2 Answers 2


You need to increase you php memory limit.

To increase your PHP memory limit:

  1. Log in to your Magento server.

  2. Locate your php.ini file using the following command: php --ini

  3. As a user with root privileges, use a text editor to open the php.ini specified by Loaded Configuration File.

  4. Locate memory_limit.

  5. Change it to a value of 2GB for normal use and debugging.

  6. Save your changes to php.ini and exit the text editor.

  7. Restart your web server.

Examples follow:

CentOS: service httpd restart

Ubuntu: service apache2 restart

nginx (both CentOS and Ubuntu): service nginx restart

Try the installation again.

  • I have 1024m, is it too small? memory_limit = 1024M
    – Sylvester
    Mar 14, 2018 at 16:23
  • It is recommended to increase it to 2GB for debugging and major installations. Remember to restart your web server.
    – Greg
    Mar 14, 2018 at 16:24
  • I gave you vote because I know it should work but it does not work for me. I do not know why ! I updated my topic.
    – Sylvester
    Mar 14, 2018 at 16:52
  • Dziekuje ;) Did you restart your web server after making those changes? Oh you did restart it... hymmm .... it don't look like it read it. What happens when you run put a full path to your php binary and also full path to where composer is installed?
    – Greg
    Mar 14, 2018 at 16:55
  • @ Bare Feet :))) What do you mean "What happens when you run put a full path to your php binary and also full path to where composer is installed" very often it installs other modules through composer and everything works fine.
    – Sylvester
    Mar 14, 2018 at 17:18

@Sylvester Please try this it may help you

which composer

it give you your composer location like mine /usr/local/bin/composer

then run this command

php -dmemory_limit=4G /usr/local/bin/composer require dotpay/magento2-payment

in my case dmemory_limit=4G You may try 2G

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.