|  | Posted by warth33 on 06/13/34 12:01 
Here we are. The problem showed up again. The php script looks likethis:
 
 ***********************************
 set_time_limit(20);
 write_to_log("Beginning at " . date('Y-m-d H:i:s'));
 $exec_command = 'app.exe';
 $str = "Before at " . date('Y-m-d H:i:s');
 write_to_log("Before at " . date('Y-m-d H:i:s'));
 try {
 write_to_log("trying at " . date('Y-m-d H:i:s'));
 exec($exec_command);
 write_to_log("after execution at " . date('Y-m-d H:i:s'));
 write_to_log("Ends at " . date('Y-m-d H:i:s'));
 }
 catch (Exception $e) {
 write_to_log("message was " . $e->getMessage());
 }
 ***********************************
 
 The log file, when everything works, contains this:
 
 ***********************************
 Beginning at 2008-01-17 19:02:09
 Before at 2008-01-17 19:02:09
 trying at 2008-01-17 19:02:09
 after execution at 2008-01-17 19:02:09
 Ends at 2008-01-17 19:02:09
 ***********************************
 
 The log file, when it hangs up, contains this:
 
 ***********************************
 Beginning at 2008-01-17 21:10:52
 Before at 2008-01-17 21:10:52
 trying at 2008-01-17 21:10:52
 ***********************************
 
 I used another c# app, a one that doesnt return anything. But the exec
 still hangs up. Most people here dont know anything about c#, but
 Ipost it cause its very simple stuff, and I think every programmer
 should understand it, even if it is a different syntax:
 
 ***********************************
 static void Main(string[] args){
 TextWriter tw = new StreamWriter("C:\\logs\\app.txt",
 true);
 tw.WriteLine("beginning at " + DateTime.Now);
 tw.WriteLine("ending at " + DateTime.Now);
 tw.Close();
 }
 ***********************************
 
 The app is only writing to the log file. And is not printing anything
 to the console (which corresponds to the return value that the php
 script use to get).
 
 The log file for the c# app, when everything works, looks like this:
 
 ***********************************
 beginning at 2008-01-17 21:10:52
 ending at 2008-01-17 21:10:52
 ***********************************
 
 And, the funny thing, it looks exactly the same, even after the exec
 hangs up. The c# is executed, always, when called from php through
 php. But, when saying that exec is hanging up, it means that it doesnt
 return. Thats all.
  Navigation: [Reply to this message] |