当前位置: 首页 > article >正文

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

手动搭建windows的php和nginx环境

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

背景

由于某种原因,只能手动搭建php的开发环境,因此就有了这篇文章

下载地址

  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 8088;
		server_name localhost;
		index index.html index.php index.htm default.php default.htm default.html;
		root D:\\jm\\co\\co1\\yoshop2.0\\public;
		
		include D:\\jm\\nginx-1.10.3\\nginx-1.10.3\\conf\\rewrite.conf;
    }

rewrite.conf

location ~* (runtime|application)/{
	return 403;
}
location / {
	try_files $uri $uri/ /index.php?$query_string;
	if (!-e $request_filename){
		rewrite  ^(.*)$  /index.php?s=$1  last;   break;
	}
}
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

  2. 安装phpmyadmin
    8.1 下载地址
    官网下载即可
    https://www.phpmyadmin.net/license/
    8.2 在nginx的配置文件中加上一个server就可以了

	server {
	listen 8087;
	server_name localhost;
	index index.html index.php index.htm default.php default.htm default.html;
	root D:\\jm\phpMyAdmin-5.2.1-all-languages\\phpMyAdmin-5.2.1-all-languages;
	
	include D:\\jm\\nginx-1.10.3\\nginx-1.10.3\\conf\\rewrite.conf;
    }

8.3 配置
进入到phpmyadmin解压包目录phpMyAdmin-5.2.1-all-languages\libraries,找到config.default.php,设置如下参数

$cfg['PmaAbsoluteUri'] = 'localhost:8087';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root用户密码';
$cfg['Servers'][$i]['auth_type'] = 'cookie';

8.4 重启nginx然后方位http://127.0.0.1:8087就可以了

参考

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


http://www.kler.cn/a/105235.html

相关文章:

  • uniapp把文件中的内复制到另一个文件中
  • 数据清洗与规范化详解
  • 分布式事务——CAP理论 解决分布式事务的思路 Seata组件初识 和 部署
  • linux实现基础网络库(socket,epoll,pthread,cmake,pipe, sem,codition,)
  • 一台服务器最大能支持多少条 TCP 连接
  • nginx负载均衡配置
  • 逐字稿 | 视频理解论文串讲(下)【论文精读】
  • 【数据结构】ST 表与 RMQ 算法
  • 如何把项目上传到Gitee(详细教程)
  • elasticsearch-5.6.15集群部署,如何部署x-pack并添加安全认证
  • 理解V3中的proxy和reflect
  • 【0229】libpq库实现压测PG服务器max_connections的最大连接数
  • CSS动画 transition和animation
  • MongoDB 学习笔记(基础)
  • Ceres 使用笔记
  • 【QT】信号和槽
  • layui移除(删除)table表格的一行
  • 一键同步,无处不在的书签体验:探索多电脑Chrome书签同步插件
  • linux安装vscode vscode使用 创建项目并运行
  • vue3项目使用TypeIt打字机