1. 程式人生 > >Win10+apache+PHP+Mysql

Win10+apache+PHP+Mysql

bin ron png pin server web發布 sys type port

一、Mysql

參考:https://www.cnblogs.com/chengjiao/p/10112830.html

二、PHP

參考:https://www.cnblogs.com/chengjiao/p/10114098.html

三、Apache

下載地址:https://www.apachehaus.com/cgi-bin/download.plx 下載windows版本包\

① 解壓到指定目錄中,配置好環境變量,cmd httpd -k install 安裝,打開 ApacheMonitor.exe 並且依次找到 httpd.conf [ apache24\conf\httpd.conf ]httpd-vhosts.conf [ apache24\conf\extra\httpd-vhosts.conf

] 、hosts [ C:\Windows\System32\drivers\etc\hosts ]和 php.ini [ php\php.ini ] 四個文件

技術分享圖片

② 修改配置文件

httpd.conf [ apache24\conf\httpd.conf ]

1)將 Define SRVROOT 和 ServerRoot 更改成你的Apache安裝路徑

Define SRVROOT "E:/Nginx+php+Mysql/apache24"
ServerRoot "E:/Nginx+php+Mysql/apache24"

2)修改 web發布目錄,也稱站點目錄,更改成你的Apache的htdocs站點路徑(你之後的項目將置放於此)

DocumentRoot "E:/Nginx+php+Mysql/apache24/htdocs"
<Directory "E:/Nginx+php+Mysql/apache24/htdocs">

3) 修改默認web文件

<IfModule dir_module>
   DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

4) 增加php解析能力,將php7apache2_4.dll 與 php 的文件目錄路徑分別 添加到 php7_module和PHPIniDir的路徑

# php7 support
LoadModule php7_module E:/Nginx+php+Mysql/php/php7apache2_4.dll
AddType application/x-httpd-php .php .html .htm
# configure the path to php.ini
PHPIniDir "E:/Nginx+php+Mysql/php"

5) 添加虛擬域名

A 將改部分的註釋# 去除

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

B ServerAdmin 進行修改

ServerAdmin 127.0.0.1:80

httpd-vhosts.conf [ apache24\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot E:/Nginx+php+Mysql/apache24/htdocs/myhcct
    ServerName   www.myhcct.local
    DirectoryIndex hello.html index.html index.htm index.php
    <Directory  "E:/Nginx+php+Mysql/apache24/htdocs/myhcct">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

a *80 本地默認所有IP 端口為80 eg:127.0.0.1:80

b DocumentRoot 項目所在路徑

c ServerName 對外訪地址

hosts [ C:\Windows\System32\drivers\etc\hosts ]

1)配合創建虛擬域名

127.0.0.1 www.myhcct.local

這裏的對外訪問路徑需要和 httpd-vhosts.conf 文件中的 ServerName 保持一致

本配置環境 Win10(64)+ mysql + php +apache

PHP

技術分享圖片

Mysql

技術分享圖片

Apache

技術分享圖片

Win10+apache+PHP+Mysql