bsasninja

Well-Known Member
Sep 2, 2004
527
0
166
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
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
16
313
Houston, TX
cPanel Access Level
Root Administrator
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.