博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
搭建Windows平台PHP、MySQL、Apache环境
阅读量:4086 次
发布时间:2019-05-25

本文共 3187 字,大约阅读时间需要 10 分钟。

Apache

软件下载

进入 ,点击 Downloada number of third party vendorsApacheHaus ,我选择下载的版本:

Apache 2.4.29 x64 ,文件名为:httpd-2.4.29-o102m-x64-vc14.zip

软件安装

conf 目录下找到 httpd.conf ,修改:

Define SRVROOT "C:/Users/SY/Desktop/GIT/Software/Apache/httpd-2.4.29-o102m-x64-vc14/Apache24"

解压到任意目录后,以管理员身份打开 cmd ,进入目录

C:\WINDOWS\system32>cd C:\Users\SY\Desktop\GIT\Software\Apache\httpd-2.4.29-o102m-x64-vc14\Apache24\binC:\Users\SY\Desktop\GIT\Software\Apache\httpd-2.4.29-o102m-x64-vc14\Apache24\bin>httpd -k install

安装成功后,关闭命令行。

在当前目录下找到 ApacheMonitor.exe ,双击打开。

点击 Start ,然后在浏览器输入 http://localhost ,正常情况下可以看到 It Works!

配置

此步骤在安装 PHP 后执行,打开 httpd.conf ,对比源文件,修改为以下内容:

#LoadModule watchdog_module modules/mod_watchdog.so#LoadModule xml2enc_module modules/mod_xml2enc.soLoadModule php7_module "C:/Users/SY/Desktop/GIT/Software/PHP/php-7.1.12-Win32-VC14-x64/php7apache2_4.dll"PHPIniDir "C:/Users/SY/Desktop/GIT/Software/PHP/php-7.1.12-Win32-VC14-x64/"AddType application/x-httpd-php .php .html .htm## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#
DirectoryIndex index.php index.html
## DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot "C:/Users/SY/Desktop/GIT/Software/PHP/Apache_Workspace/PHP/HOME"

PHP

软件下载

进入 ,点击 Downloads ,找到标题:VC14 x64 Thread Safe (2017-Nov-23 18:29:12) 下载的文件名:

php-7.1.12-Win32-VC14-x64.zip

软件安装

解压压缩文件,修改 php.ini-developmentphp.ini ,修改 php.ini 为以下内容:

; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:; extension_dir = "ext"extension_dir = "C:/Users/SY/Desktop/GIT/Software/PHP/php-7.1.12-Win32-VC14-x64/ext"extension=php_curl.dllextension=php_gd2.dllextension=php_mbstring.dllextension=php_mysqli.dllextension=php_pdo_mysql.dllextension=php_xmlrpc.dll[Date]; Defines the default timezone used by the date functions; http://php.net/date.timezone;date.timezone =date.timezone = Asia/Shanghai; where MODE is the octal representation of the mode. Note that this; does not overwrite the process's umask.; http://php.net/session.save-path;session.save_path = "/tmp"session.save_path = "C:/Users/SY/Desktop/GIT/Software/PHP/Apache_Workspace/PHP/PHPSessionTmp"; Temporary directory for HTTP uploaded files (will use system default if not; specified).; http://php.net/upload-tmp-dir;upload_tmp_dir =upload_tmp_dir ="C:/Users/SY/Desktop/GIT/Software/PHP/Apache_Workspace/PHP/PHPFileUploadTmp"

重启 Apache ,进入 http://localhost ,在目录C:\Users\SY\Desktop\GIT\Software\PHP\Apache_Workspace\PHP\HOME 放置一个文件 index.php ,输入内容:

刷新网页,如果能够看到以下画面,说明 Apache 已经关联了 PHP

这里写图片描述

修改内容:

看到打印:MySQL OK! ,说明连接数据库成功!注意 PHP7 以后使用 mysqli 代替 mysql

MySQL

软件下载

进入 ,点击 下载CommunityMySQL on WindowsMySQL Installer ,选择 Windows (x86, 32-bit), MSI Installer ,下载的文件名:mysql-installer-community-5.7.20.0.msi

软件安装

直接一路 Next...

PHPMyAdmin

软件下载

进入 ,点击 download ,下载的文件名为:phpMyAdmin-4.7.5-all-languages.zip

软件安装

将解压后的文件夹重命名为 phpMyAdmin ,放到目录:C:\Users\SY\Desktop\GIT\Software\PHP\Apache_Workspace\PHP\HOME ,在浏览器输入: 即可访问。

参考教程

你可能感兴趣的文章
最小费用最大流 修改的dijkstra + Ford-Fulksonff算法
查看>>
最小费用流 Bellman-Ford与Dijkstra 模板
查看>>
实现高性能纠删码引擎 | 纠删码技术详解(下)
查看>>
scala(1)----windows环境下安装scala以及idea开发环境下配置scala
查看>>
zookeeper(3)---zookeeper API的简单使用(增删改查操作)
查看>>
zookeeper(4)---监听器Watcher
查看>>
zookeeper(2)---shell操作
查看>>
mapReduce(3)---入门示例WordCount
查看>>
hbase(3)---shell操作
查看>>
hbase(1)---概述
查看>>
hbase(5)---API示例
查看>>
SSM-CRUD(1)---环境搭建
查看>>
SSM-CRUD(2)---查询
查看>>
SSM-CRUD (3)---查询功能改造
查看>>
Nginx(2)---安装与启动
查看>>
springBoot(5)---整合servlet、Filter、Listener
查看>>
C++ 模板类型参数
查看>>
C++ 非类型模版参数
查看>>
设计模式 依赖倒转原则 & 里氏代换原则
查看>>
DirectX11 光照
查看>>