Welcome Guest, Not a member yet? Register   Sign In
problem with shell_exec in a library.
#3

[eluser]oll[/eluser]
Thank you for the answer (and for flvtool2 tip !).
Yes, actually, I spoke about a library ( I created an extension from the php_ffmpeg one).

But anyway, it finally apperas to be a shell_exec problem when using the redirection in the script (It's a real mess to make that work), so unrelated to CI, sorry.

The test I did :


Code:
<?php

class Testbg extends Controller {

    function Testbg()     {
        parent::Controller();
        
        $this->load->library('testlib');
        //$this->load->model('testmod');
        
    }
    
        function testfgcontroller () {
        $this->benchmark->mark('code_start');
        
        exec("sleep 5 >/tmp/log 2>&1 ");
        
        $this->benchmark->mark('code_end');
        echo $this->benchmark->elapsed_time('code_start', 'code_end');
    }
    
    function testbgcontroller () {
        $this->benchmark->mark('code_start');
        
        exec("nohup sleep 5 >/tmp/log 2>&1 &");
        
        $this->benchmark->mark('code_end');
        echo $this->benchmark->elapsed_time('code_start', 'code_end');
    }
    
    function testfglib () {
        $this->benchmark->mark('code_start');
        
        $this->testlib->fg();
        
        $this->benchmark->mark('code_end');
        echo $this->benchmark->elapsed_time('code_start', 'code_end');
    }
    
    function testbglib () {
        $this->benchmark->mark('code_start');
        
        $this->testlib->bg();
        
        $this->benchmark->mark('code_end');
        echo $this->benchmark->elapsed_time('code_start', 'code_end');
    }
    
}
?>

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Testlib {
    
    function Testlib() {
    }
    
    function fg() {
        exec("sleep 5 >/tmp/log 2>&1");
    }
    
    function bg() {
        exec("nohup sleep 5 >/tmp/log 2>&1 &");
    }
}
?>

The results :

http://videos/index.php/testbg/testfgcontroller : 5.0071
http://videos/index.php/testbg/testbgcontroller : 0.0063
http://videos/index.php/testbg/testbglib: 5.0068
http://videos/index.php/testbg/testbglib : 0.0065

There's so absolutly no problem with CI Wink


Messages In This Thread
problem with shell_exec in a library. - by El Forum - 10-15-2008, 01:41 PM
problem with shell_exec in a library. - by El Forum - 10-19-2008, 04:47 AM
problem with shell_exec in a library. - by El Forum - 10-20-2008, 04:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB