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


  • try giving full path names in the script. /home/#######/public_html/app/Mage.php
    – Kalpesh
    Nov 10, 2014 at 0:29
  • 2
    Please pastebin or gist your cron script. Nov 10, 2014 at 0:51
  • Command line php interpreter may run with a different php.ini file than Apache DSO module php interpreter as well so it also may have memory_limit issues once you get the path figured out. Nov 10, 2014 at 1:42
  • Answer from Kalpesh i have tried this already it makes no difference i still get same error, but thank you. Reply to Reid Blomquist this is my current cron script you asked for; we have tried several iterations with my host provider. But i get the same error with all versions we have tried to date. They indicate it is a script error but i know people using it and it works. /usr/local/php54/bin/php-cli /home/#######/public_html/custom_scripts/dataflow_scheduled_export.php && echo test
    – Thorrrr
    Nov 10, 2014 at 12:18
  • Fiasco sorry you have lost me a little i do not understand what you mean (newbie). But this db for this install only has 50 products so we have no time out issue i believe. When run via browser it only takes 10 seconds.
    – Thorrrr
    Nov 10, 2014 at 16:15

1 Answer 1


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

  • please vote the unswer as it's right ;)
    – Sergey
    Nov 11, 2014 at 8:15
  • It wont let me !!!!!!
    – Thorrrr
    Nov 11, 2014 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.