龙空技术网

windows环境快速搭建PHP8开发环境

编程热 50

前言:

今天同学们对“php不是有效的win32应用程序”可能比较关怀,兄弟们都想要学习一些“php不是有效的win32应用程序”的相关知识。那么小编在网摘上汇集了一些有关“php不是有效的win32应用程序””的相关文章,希望我们能喜欢,同学们快快来学习一下吧!

PHP环境开启:

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

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

我这里的存放路径为:

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 编写如下代码

<?php	echo phpinfo();

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

查看php信息

标签: #php不是有效的win32应用程序 #windows启动phpnginx