PHP processes never close

0

Hello,

I am having a problem related to a PHP system that is running through a Windows Service.

The application works as follows:

  • I have a folder with several PHP files and scripts that serve as an offline application, which always runs on localhost, connects to the database, performs some specific functions, and then finishes its work.
  • There is a service in windows (done in C #) that is in charge of running this task every X minutes (a parameterizable time through a configuration file)
  • Given your time, the service runs the PHP script that is in your settings and performs the functions perfectly.
  • So far so good, my script works, but I've noticed that even after the script finishes, the PHP.exe*32 and conhost process of the windows command window still continues to run in the task manager. And over time these processes are piling up until there are 800 or more php.exe processes that are doing absolutely nothing but consume memory.

    Here's what I've tried

    • I have tried to put exit(0) or die() at the end of the scripts to see if it killed the process
    • I tried to change my windows service by looking at Process.Kill() of System.Diagnostics
    • I tried to change the PHP execution parameters on the server by setting max-execution-time to 60s

    None of the options have any effect, however I realize that this happens in certain processes, I have 3 services of these, each one running a different file and apparently only 1 of them has this problem.

    I would like to know what logic PHP performs to kill these processes or how I can force the script to kill its own process at the end of execution so that there is no stack of processes running.

    I'm using CodeIgniter in PHP scripts.

        
    asked by anonymous 07.03.2016 / 19:13

    0 answers