SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    exec() in loop failed!

    hello guys, i have a php code as below:

    Code:
    for ( $i=0;$i<$count;$i++)
    {	
    	$fh = fopen($myFile, 'w') or die("can't open file");
     	fwrite($fh, $eigenvalue[$i]);
     	fclose($fh);
    
    	$newchk = intval($chk[$i]) ^ intval($id[$i]);
    
    	$fh_2 = fopen($myFile_2, 'w') or die("can't open file");
     	fwrite($fh_2, $newchk);
     	fclose($fh_2);
    	$fh_3 = fopen($myFile_3, 'w') or die("can't open file");
     	fwrite($fh_3, $id[$i]);
     	fclose($fh_3);
    	exec('./Assign_fingerprint');
    	
    }
    The main problem is when it comes to second loop, the exec() function didn't work. why is that?

  2. #2
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This your code is taking a lot of resources with multiple fopen inside a loop

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Are you sure it enters the loop the second time?
    And how do you know the exec isn't executed? What does './Assign_fingerprint' do?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •