0

We have a custom module that executes a php script. When running the script through an observer event, the script runs without a problem. When running the script through Cron, the script runs but does not work correctly.

In the script, there is reference to a file in the magento root directly that we need to run the script properly. I think it might be that cron is running the script in a different directory.

Any help would be greatly appreciated.

  • One thing you could try is to use DirectoryListInterface when resolving paths to make sure you access the paths correctly between files. It should provide a way to reach the Magento root directory at the very least no matter what context you're running into. When it comes to cron jobs it's entirely possible that the script is running in absolute path context or in a chrooted path context. It's hard to tell without actually viewing the source code though. – gabtzi Feb 27 at 18:14
  • did you check cron log? wrong path, user permissions, missing variables. cron is very picky – MagenX Feb 27 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.