开发者

php hangs on Windows after code completion

开发者 https://www.devze.com 2023-03-12 06:29 出处:网络
We\'re using PHP only as a script interpreter (no Apache/IIS).We\'ve encountered a situation where the PHP.exe process hangs after code completion.I can confirm that the final line of code has execute

We're using PHP only as a script interpreter (no Apache/IIS). We've encountered a situation where the PHP.exe process hangs after code completion. I can confirm that the final line of code has executed (e.g., an echo to console of the return code) but the PHP.exe process remains. Though the code does use exec() and passthru() at some points, logging confirms that control is passed back to the PHP process and it continues merrily along its way.

Using Process Hacker, I've found that there are always these three threads runnin开发者_开发技巧g:

  • php.exe+0x2d78
  • ntdll.dll!RtlSetLastWin32ErrorAndNtStatusFromNtStatus+0x59
  • mswsock.dll+0x58ab

The address points are always the same in all cases. All three threads report "State: Wait:UserRequest" and the php.exe and ntdll.dll threads have the same start time while the mswsock.dll starts a few seconds later. Using Process Hacker's "Analyze" ability to see why they are hanging, it says that none of the threads appear to be waiting.

I find it odd that mswsock.dll is starting after the others -- no idea why that would be since the code has completed. But it appears to me that php.exe is using the SetLastError() export to record the last error code but it isn't able to complete?

Any other ideas on what might be going on here?


Which version of PHP do you use -- Thread Safe or Non Thread Safe and which version?

If the answer is "Thread Safe" and because you are using it in CLI mode only, I would recommend using Non Thread Safe build.

I do not know which code you are using there but it works fine here when using sockets (like, sending email via SMTP directly).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号