Stand alone Magento scripts

Before running any stand alone scripts that use core Magento objects and functionality, you need to make sure Magento is properly initialised.

Add this snippet to the top of your script, updating the path accordingly.

define('PATH_TO_MAGENTO', '/var/www/magento'); // update accordingly
require_once PATH_TO_MAGENTO.'/app/Mage.php';
// your php code here

Comments are closed.