|
Posted by Jerry Stuckle on 01/18/08 00:51
warth33@hotmail.com wrote:
> Here we are. The problem showed up again. The php script looks like
> this:
>
> ***********************************
> 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.
>
Interesting. So the C# program writes its final log entry and something
hangs.
I would say it's in one of two places - either the C# program, or, more
likely, Windows. The reason I say the latter is because your C# program
just goes through its termination code and back to Windows. Windows
should then return control to PHP.
It doesn't look like this last part is getting done - there isn't a lot
for PHP to do before it continues execution of your program.
Is there anything in your Event Logs showing a problem? Can you still
see the C# process running in the system?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|