A quick question about Cron

Discussion in 'PHP' started by Crayz, Feb 2, 2007.

  1. #1
    Hello, I was wondering if it's possible to make a certain PHP file only accessible to the cron command I set up in the cPanel. Meaning, no one can visit it via browser.

    Thanks!
     
    Crayz, Feb 2, 2007 IP
  2. jmacleod

    jmacleod Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    As long as the file is not in your public_html folder it cannot be seen via a browser...put the file eslewhere and setup the cron job for it...

    jmacleod
     
    jmacleod, Feb 2, 2007 IP
  3. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    and make sure ti give it execution permission and php path as well.
     
    pixel_perfect, Feb 3, 2007 IP
  4. Nikolas

    Nikolas Well-Known Member

    Messages:
    1,022
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    150
    #4
    If it is not possible to put it on a private directory you can try this :

    
    if ( isset($_SERVER['HTTP_HOST']) ) exit;
    
    PHP:
     
    Nikolas, Feb 3, 2007 IP
  5. alecs

    alecs Well-Known Member

    Messages:
    156
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #5
    Or you can use htaccess to restrict http requests :). There are lots of ways.
     
    alecs, Feb 4, 2007 IP