CLI issues - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: CLI issues (/showthread.php?tid=43743) |
CLI issues - El Forum - 07-21-2011 [eluser]cpass78[/eluser] Hello all, Im having an issue with running a part of my app via cli. I think the issue is with how i am using htaccess to redirect part of my site to https. There soesnt seem to be very detailed docs on how to use the CLI approach so is there something special that needs to be done? Im using core 2.0.2 and need to call 4 methods in a controller daily via cron. my config file is setup like so as found on these forums in another post Code: $config['base_url'] = "http".((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "")."://".$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']); This is read from htaccess which is: Code: IfModule mod_rewrite.c> Now this all works awesome for the website but seems to break the cron call. The error I get is: Quote:root@:/****/****/public_html# php index.php cronrun getDaily There are no closing php tags and no session interaction so im not sure just what the problem is. Thanks for any insight. CLI issues - El Forum - 07-22-2011 [eluser]toopay[/eluser] You CAN NOT get some environment variable in CLI mode(this including HTTP_HOST), you should give some exception somehow, in your config file for STDIN request! CLI issues - El Forum - 07-22-2011 [eluser]cpass78[/eluser] Ok thanks for the info. Do you have an example of what that would look like? CLI issues - El Forum - 07-22-2011 [eluser]toopay[/eluser] In config, you could have something like : Code: if (defined('STDIN')) CLI issues - El Forum - 07-22-2011 [eluser]cpass78[/eluser] Wow I was totally overthinking this. That worked perfect, thank you! CLI issues - El Forum - 07-25-2011 [eluser]nikes[/eluser] That worked perfect, thank you! CLI issues - El Forum - 10-11-2013 [eluser]Unknown[/eluser] That's what I was looking for. Thanks |