windows7配置Nginx+php+mysql的详细教程(2)

@echo off rem the use of bat echo ==================begin======================== cls SET NGINX_PATH=C: SET NGINX_DIR=C:\wnmp\nginx\ SET PHP_DIR=C:\wnmp\php\ color 0a TITLE Nginx Manager CLS ECHO. ECHO. * * Nginx Manage App * ECHO. :MENU ECHO. * nginx process list * tasklist|findstr /i "nginx.exe" ECHO. ECHO. [1] start Nginx ECHO. [2] stop Nginx ECHO. [3] restart Nginx ECHO. [4] exit ECHO. ECHO.Please input the number: set /p ID= IF "%id%"=="1" GOTO start IF "%id%"=="2" GOTO stop IF "%id%"=="3" GOTO restart IF "%id%"=="4" EXIT PAUSE :start call :startNginx call :startPhpFastCGI GOTO MENU :stop call :shutdownNginx GOTO MENU :restart call :shutdownNginx call :startNginx GOTO MENU :shutdownNginx ECHO. ECHO.Stop Nginx...... taskkill /F /IM nginx.exe > nul ECHO.Stopping PHP FastCGI...... ECHO.OK,Stop all nginx process and php fastcgi goto :eof :startNginx ECHO. ECHO.Start Nginx...... IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe" is not exists %NGINX_PATH% cd "%NGINX_DIR%" IF EXIST "%NGINX_DIR%nginx.exe" ( echo "start '' nginx.exe" start "" nginx.exe ) ECHO.OK goto :eof :startPhpFastCGI ECHO. ECHO.Start PHP FastCGI...... IF NOT EXIST "%PHP_DIR%php-cgi.exe" ECHO "%PHP_DIR%php-cgi.exe" is not exists %NGINX_PATH% cd "%PHP_DIR%" IF EXIST "%PHP_DIR%php-cgi.exe" ( echo "start '' php-cgi.exe" start /b php-cgi.exe -b 127.0.0.1:9001 -c php.ini ) ECHO.OK goto :eof

  (6)测试成功

      在C:\wnmp下新建www文件夹,在www文件夹下新建php文件 index.php,并做如下编辑

      如下mysqli_connect()代码部分需要 做相应更改。

<html> <head> <title>test mysql+php+nginx</title> </head> <body> <?php $link = mysqli_connect("localhost","root","root"); if($link){ echo "db connect success!"; }else{ echo "db connect failed!"; } ?> <br> <?php phpinfo();?> </body> </html> 

      双击上述 start.bat脚本文件,键盘输入 1后按下回车键

        如下图所示,则表示nginx-php启动成功

windows7配置Nginx+php+mysql的详细教程

      打开浏览器,在浏览器地址栏内键入:,如看到如下图所示界面,说明wnmp配置成功。

  至此,WNMP配置成功!

以上所述是小编给大家介绍的windows7配置Nginx+php+mysql的详细教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/af3c091c80edeb32778903cb1ed6727f.html