PHP环境开启:
1.下载windows版本php程序,下载链接如下:
https://windows.php.net/downloads/releases/archives/
在选择合适的版本下载后,我这里 选择 php-8.3.4-Win32-vs16-x64.zip
我这里的存放路径为:
E:\Program Files\php-8.3.4-Win32-vs16-x64
可以将路径添加环境变量:
2.配置PHP配置文件php.ini
C:\Users\fengt>cd /d E:\Program Files\php-8.3.4-Win32-vs16-x64
E:\Program Files\php-8.3.4-Win32-vs16-x64>copy php.ini-development php.ini
已复制         1 个文件。3.启动php-cgi守护进程,如下图
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编写php代码:
在 E:\php_dev\index.php 编写如下代码
<?php
	echo phpinfo();浏览器访问地址,查看PHP信息:
