配置服务器

1.首先有Apache PHP MySQL的安装包
2.在D盘新建一个文件夹为myphp2017
2.解析Apache安装包在myphp2017里面
3.打开Apache下面的conf下面的httpd.conf,进行步骤修改
①将ServerRoot的路径改为 "D:myphp2017Apache"
②将DoDocumentRoot 的路径改为 "D:myphp2017Apachehtdocs"
③将DoDocumentRoot下面的Directory 的路径也改为 "D:myphp2017Apachehtdocs"
④将ScriptAlias 处改为ScriptAlias /cgi-bin/ "D:myphp2017Apachecgi-bin"
⑤在Directory 处改为"D:myphp2017Apachecgi-bin"
改后为
<Directory "D:myphp2017Apachecgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>


Apache就配置好了


4.将PHP安装包解析到myphp2017里面

5.在Apache下面的conf下面的httpd.conf,进行步骤修改
①在httpd.conf最后面加PHP配置
PHPIniDir "D:myphp2017php-7.0.23"
LoadModule php7_module "D:myphp2017php-7.0.23php7apache2_4.dll"
AddType application/x-httpd-php .php
②在D:myphp2017php-7.0.23下面的php.ini-development或者php.ini-production进行复制一份
其名为php.ini
③php.ini中extension_dir修改路径为extension_dir = "D:myphp2017php-7.0.23ext"

PHP配置好了

6.安装MySQL-5.5.57-winx64.mis,到myphp2017


7.配置Apache虚拟目录

①找到C:WindowsSystem32driversetc下面的hosts
②在hosts里最后面加 127.0.0.1 www.blog.com(本机名 地址)
③在Apache下面的conf下面的httpd.conf里
处Virtual hosts下面那行去掉#
④找到D:myphp2017Apacheconfextra下面的httpd-vhosts.conf
⑤将其里面全部注释,在后面加
<VirtualHost *:80>
#邮箱名
ServerAdmin 231663806@qq.com

DocumentRoot "D:myphp2017logphp"
ServerName www.blog.com
DirectoryIndex login.php
ErrorLog "logs/blog.com-error.log"
CustomLog "logs/blog.com-access.log" common
<Directory "D:myphp2017logphp">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>


原文地址:https://www.cnblogs.com/ZJCD/p/7638889.html