Home php教程 php手册 window+nginx+php

window+nginx+php

Jun 06, 2016 pm 07:49 PM
bbs http

见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个还是要等等吧..........

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

What is http status code 403? What is http status code 403? Oct 07, 2023 pm 02:04 PM

HTTP status code 403 means that the server rejected the client's request. The solution to http status code 403 is: 1. Check the authentication credentials. If the server requires authentication, ensure that the correct credentials are provided; 2. Check the IP address restrictions. If the server has restricted the IP address, ensure that the client's IP address is restricted. Whitelisted or not blacklisted; 3. Check the file permission settings. If the 403 status code is related to the permission settings of the file or directory, ensure that the client has sufficient permissions to access these files or directories, etc.

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS Sep 26, 2023 am 11:19 AM

How to use NginxProxyManager to implement automatic jump from HTTP to HTTPS. With the development of the Internet, more and more websites are beginning to use the HTTPS protocol to encrypt data transmission to improve data security and user privacy protection. Since the HTTPS protocol requires the support of an SSL certificate, certain technical support is required when deploying the HTTPS protocol. Nginx is a powerful and commonly used HTTP server and reverse proxy server, and NginxProxy

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

What does bbs mean? What does bbs mean? Mar 06, 2024 pm 04:14 PM

The full name of bbs is Bulletin Board System, which means "electronic bulletin board system" in Chinese. It generally refers to an online forum and is an online communication place related to network technology. Its characteristics: large amount of information, fast information update, and strong interactivity.

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files With the development of the Internet, the file download function has become one of the basic needs of many websites and applications. For scenarios where multiple files need to be downloaded at the same time, the traditional synchronous download method is often inefficient and time-consuming. For this reason, using PHP to download multiple files asynchronously over HTTP has become an increasingly common solution. This article will analyze in detail how to use PHP asynchronous HTTP through an actual development case.

Send POST request with form data using http.PostForm function Send POST request with form data using http.PostForm function Jul 25, 2023 pm 10:51 PM

Use the http.PostForm function to send a POST request with form data. In the http package of the Go language, you can use the http.PostForm function to send a POST request with form data. The prototype of the http.PostForm function is as follows: funcPostForm(urlstring,dataurl.Values)(resp*http.Response,errerror)where, u

What does bbs mean? What does bbs mean? Jan 04, 2024 am 10:56 AM

The full English name of BBS is "Bulletin Board System", and the Chinese name is "Electronic Bulletin Board System". In China, it is generally called an Internet forum. In its early days, it had the same nature as bulletin boards on the streets and on campus, except that it was used to spread or obtain information through computers. It was not until personal computers began to become popular that someone tried to transfer the BBS on Apple computers to personal computers, and BBS began to gradually become popular.

See all articles