Home >Backend Development >PHP Tutorial >Install Nginx, PHP, mysql on Windows
Instructions
Since the machine itself is a Windows x64 system, all x64 software is selected; if you want to choose x86, it is also compatible; if the machine is x86, you can only choose x86 software
Download address
, phpInstall
nginxSelect the software installation directory as
nginx.exe -s stop
unzip
Just click to install
InstallRunHid denConsole
, phpModify
c:zjcserverginx confnginx.confmodify
<code> #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} </code>
to
<code> location ~ \.php$ { # root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME c:/zjc/www$fastcgi_script_name; include fastcgi_params; } </code>
Start and stop script
<code>cd server<span>\php</span> ..<span>\utils</span><span>\RunHiddenConsole</span>.exe php-cgi.exe -b 127.0.0.1:9000 -c c:/zjc/server/php/php.ini cd ..<span>\.</span>. cd server<span>\nginx</span> ..<span>\utils</span><span>\RunHiddenConsole</span>.exe nginx.exe cd ..<span>\.</span>.</code>
<code><span>taskkill</span> /F /IM nginx.exe > <span>nul</span><span>taskkill</span> /F /IM php-cgi.exe > <span>nul</span></code>
, php
Create filec:zjcwwwindex.phpVisit, the content is
<code><span><?php</span><span>echo</span> phpinfo(); <span>?></span></code>
http://127.0.0.1/index.phpmysql, OK Just see the php related information
Installation configuration
Run
extension=php_mysqli.dll
, php , mysqlNew webpage
c:zjcwwwcheck_mysql.php The content is
<code><span><?php</span><span>$con</span> = mysqli_connect(<span>"localhost"</span>, <span>"root"</span>, <span>"a123456"</span>); <span>if</span>(!<span>$con</span>) { <span>die</span>(<span>'Could not connect: '</span> . mysqli_error()); } <span>else</span> { <span>echo</span><span>"Database connected successfully"</span>; } mysqli_close(<span>$con</span>);</code>
<code><span>$ </span><span>c:</span><span>$ </span>cd <span>c:</span>\zjc <span>$ </span>svr_stop.bat <span>$ </span>svr_start.bat</code>
Visit the webpage
http://127.0.0.1/check_mysql.phpYou can see the message of successful connection
Copyright statement: This article is an original article by the blogger , may not be reproduced without the permission of the blogger.The above introduces the installation of Nginx, PHP, and mysql on Windows, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.