Home >Backend Development >PHP Tutorial >A case of using RunHiddenConsole to start nginx and php under windows

A case of using RunHiddenConsole to start nginx and php under windows

黄舟
黄舟Original
2017-10-31 09:29:531592browse

Use RunHiddenConsole to start nginx and php

RunHiddenConsole.exe is to automatically close the script after executing the command line script. Processes started from scripts are not closed. To put it simply, the black form (CMD command form) will not be displayed, but the programs running in the CMD command form will not be closed, especially some commands that will hang and must display the command form, such as Tomcat. , Php, Nginx, etc.

1. Start Php and Nginx, set php_home and nginx_home according to your own environment, and then save it as a .bat file.

@echo off 
set php_home=./php/php-5.6.1-nts-Win32-VC11-x64 
set nginx_home=./nginx/nginx-1.7.4 
 
REM Windows 下无效 
REM set PHP_FCGI_CHILDREN=5 
 
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量 
set PHP_FCGI_MAX_REQUESTS=1000 
 
echo Starting PHP FastCGI... 
RunHiddenConsole %php_home%/php-cgi.exe -b 127.0.0.1:9000 -c %php_home%/php.ini 
 
echo Starting nginx... 
RunHiddenConsole %nginx_home%/nginx.exe -p %nginx_home%

2. Close Php and Nginx

@echo off 
echo Stopping nginx... 
taskkill /F /IM nginx.exe > nul 
echo Stopping PHP FastCGI... 
taskkill /F /IM php-cgi.exe > nul 
exit

The above is the detailed content of A case of using RunHiddenConsole to start nginx and php under windows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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