I am attempting to get the quantity of an item by inputting the sku. The following code works great on my WAMP local installation:
require_once('app\Mage.php');
umask(0);
Mage::app();
$sku='TEST1';
$product = Mage::getModel('catalog/product/info')->loadByAttribute('sku',$sku);
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
echo $stock->getQty();
However, when I change to the production server I get the following errors:
PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0
PHP Fatal error: Uncaught exception 'Zend_Cache_Exception' with message 'can't get apc memory size' in /var/www/html/Example.com/us/lib/Zend/Cache.php:208
Stack trace:
#0 /var/www/html/Example.com/us/lib/Zend/Cache/Backend/Apc.php(191): Zend_Cache::throwException('can't get apc m...')
#1 /var/www/html/Example.com/us/lib/Zend/Cache/Backend/TwoLevels.php(488): Zend_Cache_Backend_Apc->getFillingPercentage()
#2 /var/www/html/Example.com/us/lib/Zend/Cache/Backend/TwoLevels.php(173): Zend_Cache_Backend_TwoLevels->_getFastFillingPercentage('saving')
#3 /var/www/html/Example.com/us/lib/Zend/Cache/Core.php(381): Zend_Cache_Backend_TwoLevels->save('a:7:{s:10:"bloc...', 'JFMG_CORE_CACHE...', Array, NULL)
#4 /var/www/html/Example.com/us/lib/Varien/Cache/Core.php(76): Zend_Cache_Core->save('a:7:{s:10:"bloc...', 'CORE_CACHE_OPTI...', Array, NULL, 8)
#5 /var/www/html/Example.com/us/app/code/core/Mage/Core/Model/Cache.php(349): Varien_Cache_Core->save('a:7:{s:10:"bloc...', 'CORE_CACHE_OPTI...', Array, NULL)
#6 /var/www/html/Example.com/us/app/code/c in /var/www/html/Example.com/us/lib/Zend/Cache.php on line 208
The production server is running Linux so I did change the back slash to forward slash in the first line to:
require_once('app/Mage.php');
"Example.com" is substituted for my domain name. In both cases I am using Magento 1.4.1.1. Any help or comments would be greatly appreciated. Thanks.