1.下载windows版本php程序,下载链接如下:

https://windows.php.net/downloads/releases/archives/

在选择得当的版本下载后,我这里 选择 php-8.3.4-Win32-vs16-x64.zip

windows搭建php环境windows情况快速搭建PHP8开辟情况 NoSQL

我这里的存放路径为:

E:\Program Files\php-8.3.4-Win32-vs16-x64

可以将路径添加环境变量:

windows 添加PHP环境变量

添加完环境变量,进行命令行查看

2.配置PHP配置文件php.ini

C:\Users\fengt>cd /d E:\Program Files\php-8.3.4-Win32-vs16-x64E:\Program Files\php-8.3.4-Win32-vs16-x64>copy php.ini-development php.ini已复制 1 个文件。

3.启动php-cgi守护进程,如下图

php-cgi守护进程启动,监听9000端口

nginx环境配置:

下载windows nginx环境,我这里是 nginx-1.24.0

编辑配置文件,新增如下server

server { listen 80; server_name localhost; #charset koi8-r; access_log logs/local.access.log main; error_log logs/local.error.log; root E:/php_dev; index index.php index.html index.htm; location / { # 考试测验直接访问文件,如果不存在则考试测验目录 try_files $uri $uri/ /index.php?$args; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }

启动nginx

E:\Program Files\nginx-1.24.0> .\nginx.exe

查看nginx启动情形

编写php代码:

在 E:\php_dev\index.php 编写如下代码

<?phpecho phpinfo();

浏览器访问地址,查看PHP信息:

查看php信息