1、php-7.3.4-nts-Win32-VC15-x64
2、nginx-1.14.2
3、mysql-5.7.23-winx64
二、配置
1、php.ini配置
extension_dir = \公众D:\php-7.3.4-nts-Win32-VC15-x64\ext\"大众cgi.fix_pathinfo=1extension=mysqliextension=pdo_mysqldate.timezone = Asia/Shanghaienable_dl = Oncgi.force_redirect = 0fastcgi.impersonate = 1cgi.rfc2616_headers = 1
2、nginx.conf配置
location ~ \.php$ { root D:/nginx-1.14.2/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; # 这里$document_root指的是上面定义好的nginx根 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
3、mysql安装
1.)下载免安装的压缩包mysql-5.7.21-winx64.zip
<http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.23-winx64.zip> )解压到相应的目录(此处解压到F:\mysql-5.7.21-winx64))配置环境变量,将MySQL的启动目录(F:\mysql-5.7.21-winx64\bin)添加到Path中
4.)在MySQL目录下(D:\mysql-5.7.23-winx64)创建my.ini文件,内容如下:
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\mysql-5.7.23-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\mysql-5.7.23-winx64\data # 许可最大连接数 max_connections=200 # 做事端利用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将利用的默认存储引擎 default-storage-engine=INNODB #办理报错sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
涌现msvcr120.dll缺点,下载https://www.microsoft.com/zh-CN/download/details.aspx?id=40784,安装vcredist
)管理员身份运行cmd切换目录:C:\Windows\system32>cd D:\mysql-5.7.23-winx64\bin
天生MySQL做事:
D:\mysql-5.7.23-winx64\bin>mysqld -installService successfully installed.
天生data目录,韶光较长:
D:\mysql-5.7.23-winx64\bin>mysqld --initialize-insecure --user=mysql
启动MySQL做事:
C:\Windows\system32>net start mysqlMySQL 做事正在启动 .MySQL 做事已经启动成功。)登录数据库,修正密码(默认密码为空)
登录数据库:
C:\Windows\system32>mysql -uroot -p
修正密码:
mysql> use mysql;Database changedmysql> update user set authentication_string=password(\"大众新密码\"大众) where User=\"大众root\"大众;Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1mysql>FLUSH PRIVILEGES;
7.)配置root远程登录
mysql>use mysql;mysql>GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
三、启动
开启nginx:
打开cmd命令提示符输入命令start nginx或者进入到nginx目录下,输入命令 nginx.exe,开启nginxnginx.exe -s reload 重启nginx.exe -s quit 关闭
建议利用RunHiddenConsole(用来隐蔽CMD命令窗),下载后把RunHiddenConsole.exe和批处理文件放在同一级目录,
编写批处理文件(start.bat便是批处理文件)
@echo offset php_home=D:/php-7.3.4-nts-Win32-VC15-x64set nginx_home=D:/nginx-1.14.2set PHP_FCGI_MAX_REQUESTS = 1000echo Starting PHP FastCGI...RunHiddenConsole %php_home%/php-cgi.exe -b 127.0.0.1:9000 -c %php_home%/php.iniecho Starting nginx...RunHiddenConsole %nginx_home%/nginx.exe -p %nginx_home%
stop.bat批处理如下:
@echo offecho Stopping nginx... taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...taskkill /F /IM php-cgi.exe > nulexit
开机启动的设置:
在C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup这个位置粘贴start.bat批处理文件Windows+Apache24+PHP7+Mysql5.7的FASTCGI办法安装过程
一、APACHE24配置conf/httpd.conf
ServerName localhost:8080Listen 8080
FastCGI安装
将mod_fcgid.so复制到apache的module目录下面。
配置httpd.conf在后面添加如下
LoadModule fcgid_module modules/mod_fcgid.so<IfModule fcgid_module> Options ExecCGI FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 FcgidMaxRequestsPerProcess 1000 FcgidMaxProcesses 15 FcgidIOTimeout 120 FcgidIdleTimeout 120 AddType application/x-httpd-php .php # 全局默认利用的PHP版本配置 FcgidInitialEnv PHPRC \"大众D:/php-7.3.4-nts-Win32-VC15-x64\"大众 # 上传文件的最大尺寸 100MB FcgidMaxRequestLen 104857600 <Files ~ \公众\.php$>\"大众 AddHandler fcgid-script .fcgi .php FcgidWrapper \"大众D:/php-7.3.4-nts-Win32-VC15-x64/php-cgi.exe\"大众 .php </Files></IfModule><Directory \"大众D:/Apache24/htdocs\"大众> AllowOverride All Options -Indexes +ExecCGI</Directory>把稳了,这里的 FcgidMaxRequestLen 很主要也很坑爹。当你上传文件的时候创造总是涌现500缺点,而程序实在没有缺点。 # 实际上是由于上传内容体积过大,即便修正了php.ini 中配置的上传参数也没有用的,必须修正这里才行,nginx下也会有类似的问题
extra/httpd-vhosts.conf配置,办理外部访问问题
<VirtualHost _default_:80> DocumentRoot \公众${SRVROOT}/htdocs\"大众 Allow from all Require all granted #ServerName www.example.com:80 #Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All</VirtualHost>以管理员身份运行CMD,进入Apache24\bin 目录(httpd.exe所在目录)输入 httpd.exe -k install -n \公众Apache24\公众 安装做事(注:Apache24为安装做事名称)安装基本完成。到安装目录下的bin目录中找到 ApacheMonitor.exe ,双击运行,启动apache做事
二、php配置文件php.ini
extension_dir = \"大众D:\php-7.3.4-nts-Win32-VC15-x64\ext\"大众cgi.fix_pathinfo=1extension=mysqliextension=pdo_mysqldate.timezone = Asia/Shanghaienable_dl = Oncgi.force_redirect = 0fastcgi.impersonate = 1cgi.rfc2616_headers = 1