“Windows”的版本间的差异
跳到导航
跳到搜索
(创建页面,内容为“== 查看80端口占用的程序 == # netstat -aon|findstr "80" # 拿到上一步返回的pid,tasklist|findstr {{PID}}”) |
|||
(未显示2个用户的5个中间版本) | |||
第1行: | 第1行: | ||
== 查看80端口占用的程序 == | == 查看80端口占用的程序 == | ||
− | # netstat -aon|findstr "80" | + | # <code>netstat -aon|findstr "80"</code> |
− | # | + | # 拿到上一步返回的pid,<code>tasklist|findstr {PID}</code> |
+ | |||
+ | == 切换hosts工具 == | ||
+ | * SwitchHosts! 切换hosts | ||
+ | |||
+ | |||
+ | == PHP-FastCGI on Windows == | ||
+ | 在windows环境下使用RunHiddenConsole运行php-cgi。 | ||
+ | [https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/] | ||
+ | |||
+ | # 安装nginx windows版本[https://windows.php.net/] | ||
+ | # 安装php windows版本[https://windows.php.net/] [https://windows.php.net/downloads/releases/] | ||
+ | # 安装RunHiddenConsole[https://redmine.lighttpd.net/attachments/download/660/RunHiddenConsole.zip] | ||
+ | |||
+ | start-php-fcgi.bat | ||
+ | <nowiki> | ||
+ | @ECHO OFF | ||
+ | ECHO Starting PHP FastCGI... | ||
+ | taskkill /F /IM php-cgi.exe | ||
+ | RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9000 -c d:\dev\php-5.6.9\php.ini | ||
+ | RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9001 -c d:\dev\php-5.6.9\php.ini | ||
+ | RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9002 -c d:\dev\php-5.6.9\php.ini | ||
+ | RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9003 -c d:\dev\php-5.6.9\php.ini | ||
+ | </nowiki> | ||
+ | |||
+ | start-nginx.bat | ||
+ | <nowiki> | ||
+ | :: 关闭回显,即执行本脚本时不显示执行路径和命令,直接显示结果 | ||
+ | @echo off | ||
+ | rem @author luwuer | ||
+ | |||
+ | color f8 | ||
+ | set NGINX_DIR=D:\dev\nginx\ | ||
+ | |||
+ | cd %NGINX_DIR% | ||
+ | :INFO | ||
+ | echo. | ||
+ | echo --------------------- 进程列表 --------------------- | ||
+ | tasklist|findstr /i "nginx.exe" | ||
+ | if errorlevel 1 echo nginx未启动 | ||
+ | echo --------------------- 进程列表 --------------------- | ||
+ | |||
+ | echo. | ||
+ | echo. 1. 启动Nginx | ||
+ | echo. 2. 关闭Nginx | ||
+ | echo. 3. 重启Nginx | ||
+ | echo. 4. 退出 | ||
+ | echo. | ||
+ | echo 请输入功能序号: | ||
+ | set /p id= | ||
+ | if "%id%"=="1" goto START | ||
+ | if "%id%"=="2" goto STOP | ||
+ | if "%id%"=="3" goto RESTART | ||
+ | if "%id%"=="4" exit | ||
+ | pause | ||
+ | |||
+ | :START | ||
+ | if exist "%NGINX_DIR%nginx.exe" ( | ||
+ | cd /d %NGINX_DIR% | ||
+ | start "" nginx.exe | ||
+ | echo 启动成功 | ||
+ | ) else ( | ||
+ | echo "%NGINX_DIR%nginx.exe不存在" | ||
+ | ) | ||
+ | goto INFO | ||
+ | |||
+ | :STOP | ||
+ | taskkill /F /IM nginx.exe > nul | ||
+ | echo 已关闭所有nginx进程 | ||
+ | goto INFO | ||
+ | |||
+ | :RESTART | ||
+ | taskkill /F /IM nginx.exe > nul | ||
+ | if exist "%NGINX_DIR%nginx.exe" ( | ||
+ | cd /d %NGINX_DIR% | ||
+ | start "" nginx.exe | ||
+ | ) else ( | ||
+ | echo "%NGINX_DIR%nginx.exe不存在" | ||
+ | ) | ||
+ | echo 已重启 | ||
+ | goto INFO | ||
+ | |||
+ | goto :eof | ||
+ | </nowiki> |
2019年11月27日 (三) 15:57的最新版本
查看80端口占用的程序
netstat -aon|findstr "80"
- 拿到上一步返回的pid,
tasklist|findstr {PID}
切换hosts工具
- SwitchHosts! 切换hosts
PHP-FastCGI on Windows
在windows环境下使用RunHiddenConsole运行php-cgi。 [1]
start-php-fcgi.bat
@ECHO OFF ECHO Starting PHP FastCGI... taskkill /F /IM php-cgi.exe RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9000 -c d:\dev\php-5.6.9\php.ini RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9001 -c d:\dev\php-5.6.9\php.ini RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9002 -c d:\dev\php-5.6.9\php.ini RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9003 -c d:\dev\php-5.6.9\php.ini
start-nginx.bat
:: 关闭回显,即执行本脚本时不显示执行路径和命令,直接显示结果 @echo off rem @author luwuer color f8 set NGINX_DIR=D:\dev\nginx\ cd %NGINX_DIR% :INFO echo. echo --------------------- 进程列表 --------------------- tasklist|findstr /i "nginx.exe" if errorlevel 1 echo nginx未启动 echo --------------------- 进程列表 --------------------- echo. echo. 1. 启动Nginx echo. 2. 关闭Nginx echo. 3. 重启Nginx echo. 4. 退出 echo. echo 请输入功能序号: set /p id= if "%id%"=="1" goto START if "%id%"=="2" goto STOP if "%id%"=="3" goto RESTART if "%id%"=="4" exit pause :START if exist "%NGINX_DIR%nginx.exe" ( cd /d %NGINX_DIR% start "" nginx.exe echo 启动成功 ) else ( echo "%NGINX_DIR%nginx.exe不存在" ) goto INFO :STOP taskkill /F /IM nginx.exe > nul echo 已关闭所有nginx进程 goto INFO :RESTART taskkill /F /IM nginx.exe > nul if exist "%NGINX_DIR%nginx.exe" ( cd /d %NGINX_DIR% start "" nginx.exe ) else ( echo "%NGINX_DIR%nginx.exe不存在" ) echo 已重启 goto INFO goto :eof