I am using Magento version and email not working I also set complete cron in my CPanel with .sh and .php but not working how can I resolved the issue.

php cron :- php -f /home/username/public_html/cron.php

sh cron :- sh /home/username/public_html/cron.sh
  • 1
    already install AOE_Scheduler module Commented Oct 18, 2016 at 11:01
  • In my error_log file this type error showing [18-Oct-2016 11:17:41 UTC] PHP Notice: Undefined index: SCRIPT_FILENAME in /home/username/public_html/cron.php on line 41 Commented Oct 18, 2016 at 11:19
  • If the cron is not working with these commands, it might be because shell execution via PHP is disabled. Please refer to this answer for a solution: magento.stackexchange.com/questions/137130/… Commented Oct 20, 2016 at 20:31

3 Answers 3


Please follow the steps and check:

1) go to root .htaccess file and comment the below line.

<Files cron.php>

    #Order allow,deny
    #Deny from all


2) go to your cpanel and set cron like below

*/5 * * * * wget -O - http://youdomain/cron.php >/dev/null 2>&1

Enjoy :)


You dont need to add cron.php file in cronjob cpanel if you have add cron.sh file.

add below instead of yours sh line

bin/sh /home/username/public_html/cron.sh

Solution 2:

add https://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html this extension, in system ->config of this extension you get one setting so you can remove the order mail from the queue and send in real time

Go to system->configuration->Aschroder Extensions->Smtp pro-> Queue Configuration->Queue Usage set it to never and your order email goes directly

  • run this in terminal (cmd) "-bash: bin/sh: No such file or directory" this type error showing Commented Oct 18, 2016 at 11:34
  • may be your path is wrong for cron.sh please check via this command ` cd /home/username/public_html` Commented Oct 18, 2016 at 11:38

Cron job is an important component for correct Magento performance. It is widely used for running actions that are performed on schedule, such as indexing and caching, email dispatches, sitemap generation, currency rates updates, and many more actions as well.

Log in to the server via SSH. Run crontab -e command to add a cron task. At this point you will see a text editor, where you can add or edit cron tasks. Starting from a new line, add the following record:

*/5 * * * * sh /path/to/your/magento/site/root/cron.sh

Again, don’t forget to insert your own default folder path!

Save the changes and close the file. If you did everything correctly, crontab -l command will show you the newly created task.

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