I need to run some Magento code from PHP file in nearby directory. So I created a file, lets call it
include_once '/var/www/html/app/Mage.php'; umask(0); Mage::app(); $product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'some-sku-123'); echo $product->getProductUrl();
When I open it from browser correct product URL is printed -
But when I execute this PHP file from command line via
php path/to/test.php, such URL is printed:
What's even more strange, is that previously it was working correctly, and I can't find what change did I make.
So my question is how to make sure that correct URL is printed when executed from command line?
Mage::getBaseUrl() also returns incorrect value -