2016年10月19日 星期三

在 Windows 7 上安裝 Apache + PHP +MySQL

務必注意作業系統是32還是64位元的,因為選錯了安裝會跳異常但不會跟你說是XX位元問題。

Apache 2.4 Install
下載網址:http://www.apachelounge.com/download/
安裝在C更目錄下,命名為Apache24

增修 ./Apache24\conf\httpd.conf 
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

#Find Directory index and add index.php
DirectoryIndex index.html index.php

Microsoft Visual C++ 2012 Runtime
下載網址 https://support.microsoft.com/en-us/kb/2977003 ...不裝的話會跳錯誤訊息...

PHP 5.6.12  Install
下載網址  https://support.microsoft.com/en-us/kb/2977003 ... 下載套件VC14表示是利用哪個版本的Visual Studio編譯,所以下載的套件必須搭配相對的Runtime才能使用。

安裝在C更目錄下,命名為php
增修php.ini
extension_dir = "ext"

extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_bz2.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_mbstring.dll

使用php -m 檢視載入模組是否正確,也可以使用phpinfo();來看。

在系統環境變數下
新增;c:\php;c:\Apache24;c:\Apache24\bin

命令提示字元操作
安裝Apache  c:\apache24\bin\httpd -k install
開機啟動        c:\sc config Apache2.4 start=auto

其他
網站預設路徑 C:\Apache24\htdocs

沒有留言: