php-cgi.exe quits after exactly 500 hits

前端 未结 4 1898
半阙折子戏
半阙折子戏 2020-12-25 10:31

For the life of me, I can\'t figure this out.

This is my development machine setup:

Windows 7 Home Premium 64 bit,
Webserver: NGINX 1.3.6 c:\\users\\user

4条回答
  •  梦毁少年i
    2020-12-25 11:01

    unvisible EXE file that will LOOP-RUN php-cgi.exe with passing it own command-line params, can be easily compiled in, for example, ms-VCpp6 (phpCgiExeLoop.exe ~28kb):

    #include 
    #include 
    #include "stdio.h"
    
    int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,      int       nCmdShow)
    {   while (1)
        {   SHELLEXECUTEINFO shExInfo = {0};
            shExInfo.cbSize = sizeof(shExInfo);
            shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;   shExInfo.hwnd = 0;
            shExInfo.lpVerb = "open";            // Operation to perform
            shExInfo.lpFile = "php-cgi.exe";     // Application to start    
            shExInfo.lpParameters = lpCmdLine;   // Additional parameters
            shExInfo.lpDirectory = 0;            shExInfo.nShow = SW_HIDE;
            shExInfo.hInstApp = 0;  
    
            if (ShellExecuteEx(&shExInfo))
            {   WaitForSingleObject(shExInfo.hProcess, INFINITE);
                CloseHandle(shExInfo.hProcess);
            }
        }
        return 0;
    }
    

    and running "phpCgiExeLoop -b 127.0.0.1:9000" instead of "php-cgi.exe -b 127.0.0.1:9000" ...to win-support php creators intention (avoiding possible memory-leaks).

提交回复
热议问题