The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

question of cron

Discussion in 'General Discussion' started by bsasninja, Aug 7, 2007.

  1. bsasninja

    bsasninja Well-Known Member

    Joined:
    Sep 2, 2004
    Messages:
    528
    Likes Received:
    0
    Trophy Points:
    16
    Hi, I did a script for cpanel in php but I want to run it via cron and not via http

    If you put www.site.com/script.php you see the script. Is there a way to block it via htaccess ? and run it in localhost mode??

    Thanks
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If the script is not designed to be used via a web browser interface, then you can place it outside your public_html directory (so it isn't visible to the public). I'd personally prefer to keep scripts that are not intended for public use outside of public directories so I am not relying on .htaccess etc.

    You can then do any number of things. You could make it a shell script by adding the appropriate hashbang to the top and setting executable permissions. Or you could simply call the PHP interpreter with your script as a parameter to have the script executed.
     
  3. bsasninja

    bsasninja Well-Known Member

    Joined:
    Sep 2, 2004
    Messages:
    528
    Likes Received:
    0
    Trophy Points:
    16
    Thanks I got it working ;)
     
Loading...

Share This Page