0

While using magento 1.9. I'm trying to get order last increment id using the following code while exciting the code in command line:

error_reporting ( E_ALL );
ini_set('display_errors', 1);
ini_set('memory_limit', '-1');

require_once('../app/Mage.php');

Mage::app();

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

echo Mage::getSingleton('sales/order')->getCollection()->getLastItem()->getIncrementId();

echo PHP_EOL;

I keep getting the following errors:

PHP Fatal error: Out of memory (allocated 1803288576) (tried to allocate 24 bytes) in /lib/Zend/Db/Statement/Pdo.php on line 291

Fatal error: Out of memory (allocated 1803288576) (tried to allocate 24 bytes) in /lib/Zend/Db/Statement/Pdo.php on line 291

I have about 180000 orders and PHP memory_limit is set to 2G in php.ini file.

In my file I'm already setting memory_limit to -1 which means no limit, but still out of memory.

Any recommendation on how to solve this issue would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.