本文共 3187 字,大约阅读时间需要 10 分钟。
Apache
进入 ,点击 Download
– a number of third party vendors
– ApacheHaus
,我选择下载的版本:
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-development
为 php.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
进入 ,点击 下载
– Community
– MySQL on Windows
– MySQL 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
,在浏览器输入: 即可访问。