PHP out of memory error even though memory_limit not reached
I have finally found the answer. The clue came from pcguru's answer beginning 'Since the server has only 1 GB of RAM...'.
On a hunch I looked to see whether Apache had memory limits of its own as those were likely to affect PHP's ability to allocate memory. Right at the top of httpd.conf I found this statement: RLimitMEM 204535125
This is put there by whm/cpanel. According to the following webpage whm/cpanel incorrectly calculates its value on a virtual server...
http://forums.jaguarpc.com/vps-dedicated/17341-apache-memory-limit-rlimitmem.html
The script that runs out of memory gets most of the way through, so I increased RLimitMEM to 268435456 (256 MB) and reran the script. It completed its array merge and produced the csv file for download.
ETA: After further reading about RLimitMEM and RLimitCPU I decided to remove them from httpd.conf. This allows ini_set('memory_limit','###M') to work, and I now give that particular script the extra memory it needs. I also doubled the RAM on that server.
Thank you to everyone for your help in detecting this rather thorny issue, and especially to pcguru who came up with the vital clue that got me to the solution.
Composer & Symfony - Fatal error: Out of memory
I solved my issue.
- Backup website files in local
- Install Wamp and run the servers
- Increase memory limit to 2G
- Make the
composer update
- Upload the files to the production server
I'm very confusing about composer and its requirements. It's crazy...
how to solve PHP Fatal error: Out of memory, when I try this command composer require laravel/ui for auth file.?
You can try installing this package that enables parallelization of the downloads.
composer global require hirak/prestissimo
Also when running your composer command use the -vvv flag if you are running into issues.
composer require laravel/ui -vvv
PHP out of memory error does not reflect memory_limit setting in php.ini
I found the answer.
I searched the project for memory_limit
and found out, that the composer client attempts to set a memory limit in system/modules/!composer/src/Runtime.php
There is this line: @ini_set('memory_limit', '1024M');
I changed it to @ini_set('memory_limit', '2048M');
essentially doubling the available memory, and it worked.
Related Topics
Laravel 4 Custom Named Password Column
PHP Array Find Duplicates, Sum Them Up & Delete Duplicates
Post to a Facebook Page Without "Manage_Pages" Permission Using PHP
How Best to Get Someone's 'Rank' from a Scores Table with PHP and MySQL Without Looping
What Is Null Coalescing Assignment = Operator in PHP 7.4
Overriding Upload_Max_Filesize
How to Create a Base64Encoded String from Image Resource
Split Array into Two Arrays by Index Even or Odd
Can't Install PHPunit via Pear, Requires Pear Installer >= 1.9.2, Can't Upgrade Pear from 1.9.0
Get the First or Last Friday in a Month
Compile Error: Cannot Use Isset() on the Result of an Expression
Proper Prevention of Mail Injection in PHP
PHP to Clean-Up Pasted Microsoft Input
Destroy Session When Broswer Tab Closed
Special Characters in "File_Exists" Problem (Php)
How to Change the Woocommerce_Form_Field HTML Structure
Long Integer Is Transformed When Inserted in Shorter Column, Not Truncated. Why? What Is the Formula