[摘要]在windows下搭建nginx+php环境时,php-cgi.exe会经常性的自动关闭退出,本文介绍通过使用xxfpm进程管理器管理php-cgi.exe。

 

    php-cgi.exe在windows+nginx平台下经常自动退出,网上搜到的大部分解决方法都是类似上面的批处理(代码如下)文件临时解决一下,但如果用户在网站登录的话,用户就会突然挂掉。

   

@echo off
:main
set jinchengshuliang=0
set jinchengshuliangxiaxian=2
for /f %%i in ('tasklist /nh^|findstr /i /s /c:"php-cgi.exe"') do set /a jinchengshuliang+=1

if %jinchengshuliang% lss %jinchengshuliangxiaxian% (   
goto youwenti
) else (
goto meiwenti
)  

:youwenti
echo 进程丢失,现在添加5个进程
RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
RunHiddenConsole.exe  php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
ping 127.1 -n 8
goto main

:meiwenti
echo 正常运行中!
ping 127.1 -n 8
goto main

 

最好的解决办法是用windows下的php-cgi进程管理器,该进程管理器需要用到pthreadGC2.dll。源码和编译文件在本文结尾提供下载。经测试,支持Win32和Linux-x86平台。对于用php的人,有了这个东西来维护一定数量的进程,就能制服经常崩溃退出的php-cgi啦!

下载地址:http://down.chinaz.com/soft/31157.htm

 

 

以下是xxfpm进程管理器的操作参数:

 1 Usage: xxfpm path [-n number] [-i ip] [-p port]
 2 Manage FastCGI processes.
 3 
 4 -n, --number number of processes to keep
 5 -i, --ip ip address to bind
 6 -p, --port port to bind, default is 8000
 7 -u, --user start processes using specified linux user
 8 -g, --group start processes using specified linux group
 9 -r, --root change root direcotry for the processes
10 -h, --help output usage information and exit
11 -v, --version output version information and exit
View Code

相关文章:

  • 2022-12-23
  • 2021-06-30
  • 2021-06-02
  • 2021-08-03
  • 2021-06-17
  • 2021-06-05
  • 2022-12-23
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2023-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案