Magento – Getting Fatal Error from Cron php script but runs 100% in browser

crondataflowPHP

I have a custom dataflow export script that when i run via the browser it works 100% no issue.
But soon as i add it to a cron i get a fatal error in my email report

"Fatal error: Class 'Mage' not found in /home/#######/public_html/custom_scripts/dataflow_scheduled_export.php on line 87"

Struggling to work out why it runs fine from browser but not via cron job???

Help needed please

Script

Best Answer

When you running this script via cron - first you must change directory to script directory, so yoou must do cd /home/#######/public_html/custom_scripts/ first and then run script so cron command must look something like

cd /home/#######/public_html/custom_scripts/; php dataflow_scheduled_export.php

I think

Related Topic