Welcome Guest, Not a member yet? Register   Sign In
CLI issues
#1

[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>
    RewriteEngine on

    RewriteCond $1 !^(index\.php|assets|images|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1

    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} (login|register|my_account|subscribe|assets)
    RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]

    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !(login|register|my_account|subscribe|assets)
    RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

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
PHP Notice: Undefined index: HTTP_HOST in /****/****/****/application/config/config.php on line 17
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message: Undefined index: HTTP_HOST</p>
<p>Filename: config/config.php</p>
<p>Line Number: 17</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at /****/****/****/system/core/Exceptions.php:170)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 671</p>

There are no closing php tags and no session interaction so im not sure just what the problem is.

Thanks for any insight.


Messages In This Thread
CLI issues - by El Forum - 07-21-2011, 12:44 PM
CLI issues - by El Forum - 07-22-2011, 03:14 AM
CLI issues - by El Forum - 07-22-2011, 06:04 AM
CLI issues - by El Forum - 07-22-2011, 08:39 AM
CLI issues - by El Forum - 07-22-2011, 08:59 AM
CLI issues - by El Forum - 07-25-2011, 09:56 PM
CLI issues - by El Forum - 10-11-2013, 05:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB