个人搭建WNMP的过程如下:
1.安装1.1 MySQL5.7.29 :使用的msi在线安装包,并装一个Workbench。个人采用的都是默认。
1.2 Nginx-1.16.1 :直接解压到文件夹即可。
1.3 Php-7.4.4-Win32-vc15-x64 :非编译版本,直接解压即可。
2.配置 2.1 Nginx..nginx-1.16.1confnginx.conf 里:本是/script 修改为$document_root.
这里的root是指你的php文件所在的位置。这里的html是指nginx-1.16.1html这个文件夹。
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
php.ini-production或php.ini-development重命名为php.ini。重命名前请备份。
修改extension_dir为php目录下的ext目录。此处为
extension_dir = "C:php7ext"
3.运行测试所有的的命令都是在cmd下运行,且都在程序所在的根目录运行文件,或者也可添加环境变量,直接使用。
先重新加载nginx.conf文件:
nginx -s reload
再运行php-cgi.exe:
php-cgi.exe -b 127.0.0.1:9000 -c c:php7php.ini
最后在html文件下新建test.php文件:
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
在浏览器中打开:
localhost:80/test.php
参考资料mysql:
http://c.biancheng.net/view/2376.html
nginx:
https://segmentfault.com/q/1010000004854045
https://blog.csdn.net/weixin_41782253/article/details/82706617
https://blog.csdn.net/chenweijiSun/article/details/70823482
php:
https://blog.csdn.net/aloha12/article/details/88852714