Hello!
I have a web-app running on a paid VPS. No problem there. I'm moving this app to my own dedicated server.
Current Cloud Server -CS-: Centos 6 x86_64; 2 Gb Ram; 2 vCPU
Virtual on Dedicated Server: Centos 7 x86_64; 2 Gb Ram; 2 vCPU
I deployed the PC with the same specs because "if it works okay with that it should work with the same".
On a API's endpoint the current CS returns the correct json. The new Server returns:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 4294967296 bytes) in /var/www/api/Components/Database.php on line 439
line 439 is:
call_user_func_array(array($stmt, 'bind_result'), $parameters);
The search results I found here and there were not helpful. Some said upgrade PHP version and 90% of them is set a larger memory limit. ** I did**. I set it to 256M, 512M, 2GB (beyond this there is no ram available), 4GB and 5GB. ** Nada**
This query works ok on the other -and production- server.
New server:
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9
PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5
X-Powered-By: PHP/5.4.16
CS:
Server: Apache
X-Powered-By: PHP/5.5.22
I look at the LENGTH of the base64 being queried. They're 2 images data sent. This size is returned by mysql:
select LENGTH(image_base64) from pmv where pmv.model = 1;
That is the query. It returns 2 row. Image_base64 is LONGTEXT. There are some others columns but it won't add to the issue.
LENGTH(image_base64)
162678
131402
It is clearly not close to 4Gb
I can't access php/apache conf on the CS. The only thing I didn't try yet is upgrading PHP from 5.4 to 5.5. Could be it? I'll try to get access to the server on weekend to try out any other ideas.
Edit #1
I update the PHP Version to 5.6.9.
Same error:
<b>Fatal error</b>: Allowed memory size of 536870912 bytes exhausted (tried to allocate 4294967296 bytes) in <b>/var/www/api/Components/Database.php</b> on line <b>439</b><br />
Edit #2
Changing the column type from longtext to mediumtext seems to work as in this question
But why on earth I need to change the column type on this server? As far I can test now, no matter how much info is stored on that column. It will give the error as long as it's a longtext col.
Thanks!