Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Sep 2004
    Posts
    523

    Exclamation question of cron

    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. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by bsasninja View Post
    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
    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. #3
    Member
    Join Date
    Sep 2004
    Posts
    523

    Default

    Thanks I got it working

Similar Threads & Tags
Similar threads

  1. (hopefully) A simple Cron Question
    By scotch33 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-20-2009, 11:54 AM
  2. Newbie here have a cron question
    By baji26 in forum Data Protection
    Replies: 5
    Last Post: 09-10-2007, 04:50 PM
  3. Quick Cron Question
    By lamans in forum Data Protection
    Replies: 6
    Last Post: 05-20-2006, 07:56 PM
  4. question about a cron job
    By bsasninja in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 07-22-2005, 09:18 PM
  5. Cron Question - confused
    By chae in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 10-11-2004, 04:10 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube