Daniel Brown wrote:
>     This way just lets it do it's own thing, with no output,
> and PHP won't hang.  It'll continue from the CLI after the HTTP
> session is over. 
> 
> <?
> exec('php test.php > /dev/null 2>&1 &'); ?>
> 
> 
> On 5/1/07, Brad Fuller <[EMAIL PROTECTED]> wrote:
>> 
>> 
>> I found this on PHP.net:
>> 
>> http://us.php.net/manual/en/function.exec.php
>> 
>> Note: If you start a program using this function and want to leave it
>> running in the background, you have to make sure that the output of
>> that program is redirected to a file or some other output stream or
>> else PHP will hang until the execution of the program ends.
>> 
>> 
>> This is what I want... I want to execute another PHP script from the
>> CLI, pass it a parameter and let it go to town after the HTTP
>> request closes. 
>> 
>> Can someone please illustrate how I can make this work?
>> 
>> Thx,
>> 
>> Brad
>> 
>> --
>> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>> http://www.php.net/unsub.php


It seems the script is calling itself even though I'm specifying a different
script to run...

test2.php

<?php   echo "Hello, World!"; ?>


test1.php

<?php
        if( !isset($_POST['account_id']) || $_POST['account_id'] == "" ) {
                echo "account_id is required.";
                exit;
        }

        // more stuff here...

        exec("/usr/bin/php -q /path/to/test2.php", $output); // should run
test2.php

        echo "<pre>";
        print_r($output);
        echo "</pre>";

?>


http://www.example.com/test1.php

Expected Result:

Array
(
    [0] => Hello, World!
)


Actual Result:

Array
(
    [0] => X-Powered-By: PHP/5.2.1
    [1] => Content-type: text/html
    [2] => 
    [3] => account_id is required.
)

Can anyone explain this and possibly help me find a solution?

Thx,

Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to