How to configure Magento 1.9 Cron Job to run on a Windows Server 2016?
-
07-01-2021 - |
Question
I would like to set the Cron Job to allow Magento to send emails after new orders from customers. I tried running Magento Cron Job on Windows Task Scheduler with the script from wget.exe
and an argument of http://mywebsite.com/cron.php, with a trigger that repeats every minute. However, I'm still not able to send emails. I have searched everywhere to find info about this and I'm not sure if I configured it the appropriate way and which one is supposed to be running cron.php
or cron.sh
? Thanks a lot for the help!
La solution
PHP has different configurations via web or via console: usually it is a lot limited via the webserver, in terms of memory allowed, execution time and so. So you should run cron.php via shell.
- Prepare a
.bat
file runningphp C:\path_to_magento\cron.php
using absolute file path - Run from command prompt:
schtasks /create /sc minute /mo 5 /tn Magento\Cron /tr path_to_bat_file\filename.bat
- Click Magento on Task Scheduler library
- From Properties, click Change User or Group and choose a System username
Your cron will run each 5 minutes.
Only order emails are subject to cron: the other emails (ie. Customer Registration) are sent instantly. You can check if the smtp server is correctly set by registering.