cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 Randomly Allowed memory size of 2GB exhausted PHP 7.1.1

Magento 1.9 Randomly Allowed memory size of 2GB exhausted PHP 7.1.1

I got a php error randomly, Allowed memory size of 2147483648 bytes exhauste and customers see the 500 Internal Server Error.
It happens most often after importing products with Dataflow. After that on frontend, when customers want to add a product to the basket or finalize the order, the error appears.
Below the details of the error. I need help in determining what cause the error.

 

Array([0] => SELECT `main_table`.* FROM `sales_flat_quote_address_item` AS `main_table` WHERE (`quote_address_id` = '59764')
[1] => Array
(
[shipping_method] => tablerate_bestway
[form_key] => msbjhd
)
[2] => Array
(

[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /checkout/onepage/saveShippingMethod/
[QUERY_STRING] => 
[REQUEST_METHOD] => POST
[SERVER_PROTOCOL] => HTTP/1.1
[GATEWAY_INTERFACE] => CGI/1.1
[REDIRECT_URL] => /checkout/onepage/saveShippingMethod/
[REMOTE_PORT] => 33215
[SERVER_SOFTWARE] => Apache/2.4.10 (Debian)

[HTTP_ACCEPT_ENCODING] => gzip, deflate, br
[HTTP_REFERER] => https://xxx/checkout/onepage/
[CONTENT_TYPE] => application/x-www-form-urlencoded; charset=UTF-8
[HTTP_USER_AGENT] => Mozilla/5.0 (Linux; Android 7.0; SM-G920F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
[HTTP_X_REQUESTED_WITH] => XMLHttpRequest

[HTTP_X_PROTOTYPE_VERSION] => 1.7
[HTTP_ACCEPT] => text/javascript, text/html, application/xml, text/xml, */*
[CONTENT_LENGTH] => 59
[HTTP_CONNECTION] => keep-alive

[SSL_SESSION_RESUMED] => Resumed

[REDIRECT_HTTP_AUTHORIZATION] => 
[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /index.php
[REQUEST_TIME_FLOAT] => 1542663024.8916
[REQUEST_TIME] => 1542663024
)
[3] => Array
(
[type] => 1
[message] => Allowed memory size of 2147483648 bytes exhausted (tried to allocate 16384 bytes)
[file] => .../lib/Zend/Db/Statement/Pdo.php
[line] => 232
))

 

Second example

Array([0] => SELECT `main_table`.*, `cp_table`.`type_id`, `status_table`.`stock_status` FROM `cataloginventory_stock_item` AS `main_table`
INNER JOIN `catalog_product_entity` AS `cp_table` ON main_table.product_id = cp_table.entity_id
LEFT JOIN `cataloginventory_stock_status` AS `status_table` ON main_table.product_id=status_table.product_id AND main_table.stock_id=status_table.stock_id AND status_table.website_id='1' WHERE (`main_table`.`stock_id` = '1') AND (`main_table`.`product_id` IN('141061'))
[1] => Array
(
[form_key] => msbjhd
[product] => 141061
[related_product] => 
[options] => Array
(
[164742] => 1839646
[164740] => 1839643
[164741] => 1839645
[164739] => 1839641
)

[qty] => 6
[isAjax] => 1
)
[2] => Array
(
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /checkout/cart/add/uenc/adfbjhdgbfdjhgbdjghbjYS5wbC9rb2xla2NqZS1kZWJvd2Uva3J6ZXNsYS1kZWJvd2Uva3J6ZXNsby1kZWJvd2UtMDJjLmh0bWw=/product/141061/form_key/msbjhd/
[QUERY_STRING] => 
[REQUEST_METHOD] => POST
[SERVER_PROTOCOL] => HTTP/1.1
[GATEWAY_INTERFACE] => CGI/1.1
[REDIRECT_URL] => /checkout/cart/add/uenc/adfbjhdgbfdjhgbdjghbjYS5wbC9rb2xla2NqZS1kZWJvd2Uva3J6ZXNsYS1kZWJvd2Uva3J6ZXNsby1kZWJvd2UtMDJjLmh0bWw=/product/141061/form_key/msbjhd/
[REMOTE_PORT] => 50221
[SERVER_SOFTWARE] => Apache/2.4.10 (Debian)

[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /index.php
[REQUEST_TIME_FLOAT] => 1542966054.1767
[REQUEST_TIME] => 1542966054
)
[3] => Array
(
[type] => 1
[message] => Allowed memory size of 2147483648 bytes exhausted (tried to allocate 16384 bytes)
[file] => ...lib/Zend/Db/Statement/Pdo.php
[line] => 232
))
1 REPLY 1

Re: Magento 1.9 Randomly Allowed memory size of 2GB exhausted PHP 7.1.1

Hello @pm84

 

You have to increase the memory limit in your server.

You can increase the memory limit from php.ini file

 

Find memory_limit in php.ini file and change value as per your need.

 

You can also change the memory limit from .user.ini file.

 

Create .user.ini file on the root folder of your Magento installation.

and add the following line to this file

 

memory_limit = 756M

 

Note: Replace 756M with the value you need.

 

 

 

If you find my answer useful, Please click Kudos & Accept as Solution.