In the same system, I can make call to db, and there is no problem, but in some case ( with the biggest table ), I get
"PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /home/forge/sximo.sp-marketing.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 311
I debugged the code and the problem is a basic query:
" SELECT partidascapturainfo.* FROM partidascapturainfo WHERE partidascapturainfo.partidascapturainfoid IS NOT NULL ORDER BY partidascapturainfoid asc LIMIT 0 , 10 "
When I run the query in a Mysql Client, query runs in 0.17s
I've already set memory_limit to 2048, restart nginx and my query only return 10 rows...
Here are my 10 rows:
123044,42016,249,3762,2,,0
123045,42016,249,3761,2,,0
123046,42016,249,3764,1,,0
123047,42016,249,3765,,,0
123048,42016,249,3775,,,0
123049,42016,249,3771,3,,0
123050,42016,249,3772,3,,0
123051,42016,250,3844,HAY,,0
123052,42016,255,3852,,,0
123053,42017,249,3761,1,,0
Any Idea what's going on???
Warning: please be advised that answer below is not a solution. One cannot increase the memory limit indefinitely. Another answer is required that helps to reduce the memory consumption instead of increasing the memory limit. As a very first measure try to update your Laravel/Eloquent versions, chances that this error is fixed in a newer version.
You can try editing /etc/php5/fpm/php.ini:
; Old Limit
; memory_limit = 512M
; New Limit
memory_limit = 2048M
You may need to restart nginx
:
sudo systemctl restart nginx
You may also have an infinite loop somewhere. Can you post the code you're calling?