php-手动搭建windows的php和nginx环境

手动搭建windows的php和nginx环境

      • 下载地址
      • 具体步骤
      • 参考

下载地址

  1. php
    官网:https://windows.php.net/downloads/releases/archives/
    csdn下载:https://download.csdn.net/download/xjhaoya/9533113?spm=1003.2122.3001.6634.19
  2. nginx
    https://blog.csdn.net/GyaoG/article/details/124081770
  3. WinSW(如果安装多进程请参考)
    https://github.com/winsw/winsw/releases/tag/v2.12.0
    https://blog.csdn.net/a1513049385/article/details/88395286

具体步骤

  1. 下载好php包
  2. 将php包目录下的php.ini-development文件,将其复制一份命名为php.ini
  3. 修改php.ini内容
extension_dir = "ext"
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_openssl.dll
  1. 启动php-cgi
    php-cgi.exe -b 127.0.0.1:9000
  2. 下载nginx的包
  3. 打开nginx.conf修改php程序的目录
    server {
        listen       8012;
		server_name localhost;
		root D:\jm\co\yoshop2.0\public;
		index index.html index.htm index.php;

		location / {
			try_files $uri $uri/ /index.php?$query_string;
		}

		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;
		}
   }
  1. 启动nginx
    进入nginx解压的目录,执行如下命令启动
    nginx.exe
    进入nginx解压的目录,执行如下命令停止nginx
    nginx.exe -s stop

参考

https://www.php.cn/faq/537691.html

你可能感兴趣的:(php,php,开发语言)