win10本地搭建apache+php+mysql運行環境

首先下載所需軟件:

Vc2015:https://www.microsoft.com/zh-CN/download/details.aspx?id=48145

Vc2012:http://www.microsoft.com/zh-CN/download/details.aspx?id=30679

Apache2.4:http://www.apachelounge.com/download

PHP:http://windows.php.net/download (下載線程安全版的,即Thread Safe)

Mysql:https://www.mysql.com/downloads

 

安裝并配置Apache

Apache版本:Apache2.4.16

解壓目錄:D:\PHP\Apache24

安裝Apache2.4.16,vc14版本的,需要先安裝Visual C++ Redistributable for Visual Studio 2015運行庫;vc11版本的,需要先安裝Visual C++ Redistributable for Visual Studio 2012運行庫

 

(1).下載回來的是解壓文件,解壓好放到要安裝的位置。

(2).打開Apache24\conf下httpd.conf 文件,修改以下關鍵位置:

ServerRoot? “D:/PHP/Apache24”(即Apache的安裝位置);

DocumentRoot? “D:/PHP/Apache24/htdocs” (Apache默認的網站根目錄,可根據自己的?? 喜好調整)

修改根目錄的選項:

修改前

<Directory "c:/Apache24/htdocs">
??? Options Indexes FollowSymLinks
??? AllowOverride null
??? Require all granted
</Directory>

修改后

<Directory "D:/PHP/Apache24/htdocs">
??? Options Indexes FollowSymLinks
??? AllowOverride All
??? Require all granted
</Directory>

#ServerName www.example.com:80 =>?ServerName 127.0.0.1:80 (去掉前面的#)

DirectoryIndex index.html =>?DirectoryIndex index.html?index.php index.htm (我們添加了? index.php index.htm)

ScriptAlias /cgi-bin/ “c:/Apache24/cgi-bin/”改為

ScriptAlias /cgi-bin/ “d:/PHP/Apache24/cgi-bin/”

<Directory “c:/Apache24/cgi-bin”> =>?<Directory “d:/PHP/Apache24/cgi-bin”>

(3).打開cmd,并輸入以下命令行

d: 回車

cd PHP\Apache24\bin 調到Apache24中bin目錄下

httpd 回車 如果沒有任何提示表示啟動成功

 

如果想在服務中添加Apache24,則以管理員身份 運行cmd,并輸入以下命令

d: 回車

cd PHP\Apache24\bin 回車

httpd.exe -k install 回車

(4).打開瀏覽器輸入“http://localhost/”進行測試,顯示”It works!”證明配置成功。

 

安裝并配置PHP

PHP版本:php5.6.14

安裝目錄:D:\PHP\php56

安裝php5.6.14需要先安裝Visual C++ Redistributable for Visual Studio 2012運行庫

 

(1).下載回來的是解壓文件,解壓好放到要安裝的位置;

(2).復制份php.ini-development,并改名為php.ini

(3).讓Apache24加載PHP模塊,打開Apache24\conf\httpd.conf,在最后加上

LoadModule php5_module “D:/PHP/php56/php5apache2_4.dll”

AddType application/x-httpd-php .php .html .htm

PHPIniDir “D:/PHP/php56” (告訴apache php.ini的位置)

(4).開啟幾個常用php擴展(根據需求自行選擇),打開php.ini文件,修改以下內容:

;extension_dir = “ext” =>?extension_dir = “D:/PHP/php56/ext”(去掉分號)

;extension=php_mbstring.dll => extension=php_mbstring.dll

;extension=php_mysql.dll => extension=php_mysql.dll

;extension=php_mysqli.dll => extension=php_mysqli.dll

注意:win下要開啟curl擴展,libeay32.dll和ssleay32.dll必須放到PATH環境變量包含的目錄下

(5).重啟Apache服務器

 

安裝Mysql

Mysql版本:mysql5.6.27

點擊文件直接安裝即可。

贊(0)
版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權, 轉載請注明出處。
文章名稱:《win10本地搭建apache+php+mysql運行環境》
文章鏈接:http://www.lrracing.com/1668.html
【聲明】:國外主機測評僅分享信息,不參與任何交易,也非中介,所有內容僅代表個人觀點,均不作直接、間接、法定、約定的保證,讀者購買風險自擔。一旦您訪問國外主機測評,即表示您已經知曉并接受了此聲明通告。
【關于安全】:任何 IDC商家都有倒閉和跑路的可能,備份永遠是最佳選擇,服務器也是機器,不勤備份是對自己極不負責的表現,請保持良好的備份習慣。