见bbs http://bbs.csdn.net/topics/390803643/close 正常的配置情况下,window的php-cgi是不会出现多线程/子进程的,如下配置 fastcgi_pass 127.0.0.1:9000; 这时也就意味着当二个php文件同时请求解析时,就会出现阻塞处理,处理时间就会是a.phpb.php,而不是并行
见bbs
http://bbs.csdn.net/topics/390803643/close
正常的配置情况下,window的php-cgi是不会出现多线程/子进程的,如下配置
fastcgi_pass 127.0.0.1:9000;
这时也就意味着当二个php文件同时请求解析时,就会出现阻塞处理,处理时间就会是a.php+b.php,而不是并行,是串行时间了.
如a.php
sleep(100);echo 1;
b.php
echo 2;
先运行a.php,100秒后输出1.在运行a.php的同时,运行b.php,2却出现在100秒以后.假设...却不是一运行就立刻出现,因为上面的配置受影响导致解析是串行时间了.
在google.翻了几个小时.
找到
The problem is that the PHP_FCGI_CHILDREN environment variable is ignored under windows, therefore php-cgi does not spawn children, and when PHP_FCGI_MAX_REQUESTS is reached the process terminates.
Check on PHP's source, file cgi_main.c, around line 1982:
#ifndef PHP_WIN32
/* Pre-fork, if required */
if (getenv("PHP_FCGI_CHILDREN")) {
char * children_str = getenv("PHP_FCGI_CHILDREN");
...
So, php with fast-cgi will **never** work on Windows.
The question is, why is forking disabled under windows?
-------------https://bugs.php.net/bug.php?id=49859-----------
得知window不支持?????
看到网上有很多人不懂怎么处理.而我的是测试服务器,觉得就算了.灵机一动.就手工的开起几个php-cgi等着吧.
于是变通方案时.
手工开起n个php-cgi等着
::window不支持 nginx的多线程,只能手工生成多个php-cgi
start "fcgi服务" /MIN /D "%batDir%php" php-cgi.exe -b 127.0.0.1:9000 -c "%batDir%php/php.ini"
start "fcgi服务" /MIN /D "%batDir%php" php-cgi.exe -b 127.0.0.1:9001 -c "%batDir%php/php.ini"
start "fcgi服务" /MIN /D "%batDir%php" php-cgi.exe -b 127.0.0.1:9002 -c "%batDir%php/php.ini"
start "fcgi服务" /MIN /D "%batDir%php" php-cgi.exe -b 127.0.0.1:9003 -c "%batDir%php/php.ini"
start "nginx服务" /MIN /D "%batDir%nginx" nginx.exe
然后nginx的
http {
#window 不能派生子进程,只能人工配 PHP_FCGI_CHILDREN 在window不起作用的
upstream fastcgi_backend {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
server 127.0.0.1:9002;
server 127.0.0.1:9003;
}
弄一个备用服务器
域名配置时,使用转发到备用服务器
server {
listen 80;
server_name q.qq;
access_log ./../log/q.qq.access.txt;
root d:/web/www;
location ~ \.php$ {
fastcgi_pass fastcgi_backend;
}
}
ok.同时打开4个php是可以独立解析了,并行,但是5个呢?第5个还是要等等吧..........

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Chinese version
Chinese version, very easy to use