SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Running a Cronjob for a PHP script in Cpanel

    I have been trying to run a php script in the cronjob settings in my cpanel but failed.

    I'm confused with the command line, can any one help with that please?

  2. #2
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What script are you running? We can better answer your question if we knew.

    Your cron job should look something like this.
    php -q /home/CPANEL-USER/public_html/SCRIPT-DIRECTORY/cron.php

    However, we can't say for sure as your script could require a special way of cron being called.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lawrence Wright View Post
    What script are you running? We can better answer your question if we knew.

    Your cron job should look something like this.
    php -q /home/CPANEL-USER/public_html/SCRIPT-DIRECTORY/cron.php

    However, we can't say for sure as your script could require a special way of cron being called.
    its a php script, a with a mail function in it...will send emails when users register!

  4. #4
    Non-Member jub.frd1's Avatar
    Join Date
    Feb 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Today I Just Found One Best Link for Cron Job May be its help you

    http://adminschoice.com/crontab-quick-reference

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    cPanel should provide you with enough prompts to get the timing correct.
    the command to issue will be what Lawrence posted. php -q <filepath>
    the filepath you can discover by echoing $_SERVER['SCRIPT_FILENAME']
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this one alright, thats what it looks like in Cpanel>cronjobSitepoint.jpg


    But doesn't work, manually running the script does!

  7. #7
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please check the image attachment above, thats what my script looks like in Cpanel, please verify if its alright...

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    cPanel should provide you with enough prompts to get the timing correct.
    the command to issue will be what Lawrence posted. php -q <filepath>
    the filepath you can discover by echoing $_SERVER['SCRIPT_FILENAME']
    Quote Originally Posted by jub.frd1 View Post
    Today I Just Found One Best Link for Cron Job May be its help you

    http://adminschoice.com/crontab-quick-reference
    Quote Originally Posted by Lawrence Wright View Post
    What script are you running? We can better answer your question if we knew.

    Your cron job should look something like this.
    php -q /home/CPANEL-USER/public_html/SCRIPT-DIRECTORY/cron.php

    However, we can't say for sure as your script could require a special way of cron being called.
    Please see above!!

  9. #9
    Non-Member jub.frd1's Avatar
    Join Date
    Feb 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @xem I don't have more knowledge on Cron Job.......... I am born baby on this matter

  10. #10
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jub.frd1 View Post
    @xem I don't have more knowledge on Cron Job.......... I am born baby on this matter
    Upload your script, go to cpanel / cron and add as follows..

    lynx -dump http://www.domain.com/script.php

    This drops me an email to say that its done and I have One set to run everynight at midnight and one on the 1st and 15th of every month.
    cron.png


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •