skip to Main Content

After installing latest version of xampp 8.0.9 when i open terminal from xampp panel i have another operating system as Debian,

uname -a -r
Linux debian 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux

now after navigating to php project inside htdocs folder i try to use composer upadte to install and upadte composer.json packages but i get this error:

composer update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies (including require-dev)

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 798220288) (tried to allocate 32134463 bytes) in /usr/share/php/Composer/Util/RemoteFilesystem.php on line 459

Fatal error: Out of memory (allocated 798220288) (tried to allocate 32134463 bytes) in /usr/share/php/Composer/Util/RemoteFilesystem.php on line 459

when i get this error i try to change memory_limit into php.ini file, then i run this command:

php --ini

output:

Configuration File (php.ini) Path: /opt/lampp/etc
Loaded Configuration File:         /opt/lampp/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

here memory_limit is -1 and as i installed php 8.0.9 it doesn’t has php folder inside /etc/ and i have only php 7.3

php -v

output:

PHP 8.0.9 (cli) (built: Jul 30 2021 09:12:42) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies

opening php.ini inside php 7.3 folder to change memory_limit, this option value has -1 too

now how can i increase memory_limit and resolve this problem?

finally running this command don’t take me any output or result:

php -d memory_limit=1024M /usr/bin/composer update

2

Answers


  1. try

    php -d memory_limit=-1 composer update
    

    so that the limit is set independently of the ini file.

    And according to php --ini your php.ini file for php 8 is in /opt/lampp/etc/php.ini not under /etc/

    Login or Signup to reply.
  2. I am getting the same issue whenever I try to use seeder in laravel to upload 1 lakh data at the same time to

    1. first you can try to PHP chunk function to try to upload few data
    foreach (array_chunk($object_array,1000) as $t)  
    {
        DB::table('table_name')->insert($t); 
    }
    

    and then run php artisan o:c

    1. run command in your terminal

    free -m

    this is free your memory

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search