The Apache Haus Forum

Please login or register.

Login with username, password and session length
Advanced search  


Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: PHP getting Apache pids or PHP pids  (Read 8702 times)


  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 620
PHP getting Apache pids or PHP pids
« on: March 02, 2009, 02:17:40 PM »

Sometimes it is usefull to get the PIDs from Apache or PHP which runs over FCGID to kill all the processes if it hangs up. Sometime I had that with the non thead safe version (NTS) to use its performance.

Code: [Select]
= new COM('winmgmts://');
$processes $wmi->ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'httpd.exe'");
$processes as $process){
'cmd line: '$process->CommandLine ' --> pid: '$process->ProcessId .'<br />';

or replace httpd.exe with php-cgi.exe and that kill it instead of print it out.

Notice: if you want to kill php-cgi processes you have to run that script with the php module in apache  ;) Otherwise the script maybe kills itself.
Pages: [1]   Go Up

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13