Welcome Guest, Not a member yet? Register   Sign In
File not executed when running from terminal
#1

[eluser]djuric[/eluser]
hi guys,

I need to run a file using CLI ( will later use it for cron ) but somehow it's not being executed. I tested by adding email function somewhere in the middle of the file so i get email ( if program gets to this line ) but no luck ( even if I put it on top )

I tried different file ( which is just in /var/www/codeigniter/test.php and not run through codeigniter ) and this works fine

Command I ran:

Code:
php /var/www/codeigniter/index.php cron dothis

and what I get is:

Code:
Set-Cookie: ci_session=a:5:{s:10:"session_id";s:32:"86a27290ff1a94dc58db92a416e213a3";s:10:"ip_address";s:7:"0.0.0.0";s:10:"user_agent";b:0;s:13:"last_activity";i:1375930801;s:9:"user_data";s:0:"";}bb99518e71917592e4545375908dd57c; expires=Thu, 08-Aug-2013 05:00:01 GMT; path=/
Content-type: text/html

<!DOCTYPE html>
&lt;html&gt;
        &lt;head&gt;
.... rest of the document here

so basically it outputs my home file HTML. I have sessions class auto loaded and changed core/Input.php due to this error which is NOT fixed in 2.1.4

Any suggestion appreciated
#2

[eluser]ivantcholakov[/eluser]
Maybe command line requests are not detected properly on this machine. You may try this file for testing, it implements the CI's method for CLI detection:

detect_cli.php

Code:
&lt;?php

if (php_sapi_name() == 'cli' or defined('STDIN'))
{
    echo 'CLI detected'."\n";
    echo 'Trying to dump $_SERVER[\'argv\']:'."\n";
    var_dump($_SERVER['argv']); // Test the script with parameters, see whether they pass.
    echo "\n";
} else {
    echo 'CLI NOT detected'."\n";
}




Theme © iAndrew 2016 - Forum software by © MyBB