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

點擊文件直接安裝即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM