Skip to main content

Getting cPanel cronjobs to work with Magento 1.9

Comments

3 comments

  • Infopro
    You might do better to ask this over on the magento support site. I just did a quicky search and found this post that might be of some use to you: magecomp.com/blog/how-to-setup-a-cron-job-in-cpanel-for-magento/
    0
  • Avensen
    I think your cron job calls stopped working correctly because starting from some 1.9.*.* version Magento added an additional block to the .htaccess to increase cron.php file security:
    ########################################### ## Deny access to cron.php ############################################ ## uncomment next lines to enable cron access with base HTTP authorization ## http://httpd.apache.org/docs/2.2/howto/auth.html ## ## Warning: .htpasswd file should be placed somewhere not accessible from the web. ## This is so that folks cannot download the password file. ## For example, if your documents are served out of /usr/local/apache/htdocs ## you might want to put the password file(s) in /usr/local/apache/. #AuthName "Cron auth" #AuthUserFile ../.htpasswd #AuthType basic #Require valid-user ############################################ Order allow,deny Deny from all
    As you can see, by default it blocks access to cron.php from any IP address. I suggest to: 1. Determine the IP address which your web server 'sees' when your cron.php is called. Find it in Raw Access logs in cPanel. 2. Modify the .htaccess file to allow access to cron.php from that IP address, change the above block in .htaccess to:
    ########################################### ## Deny access to cron.php ############################################ ## uncomment next lines to enable cron access with base HTTP authorization ## http://httpd.apache.org/docs/2.2/howto/auth.html ## ## Warning: .htpasswd file should be placed somewhere not accessible from the web. ## This is so that folks cannot download the password file. ## For example, if your documents are served out of /usr/local/apache/htdocs ## you might want to put the password file(s) in /usr/local/apache/. #AuthName "Cron auth" #AuthUserFile ../.htpasswd #AuthType basic #Require valid-user ############################################ Order Deny,Allow Deny from all Allow from 1.2.3.4
    change 1.2.3.4 to the determined IP address from the Raw Access logs.
    0
  • Avensen
    Also, I suggest to use this command in cPanel Cron Jobs to call Magento cron:
    wget -O - -q 'http://www.yourdomain.com/cron.php'
    change www.yourdomain.com to your Magento installation domain.
    0

Please sign in to leave a comment.