windows下apache+php+mysql 環境配置方法

來源:互聯網
上載者:User

標籤:

轉自:http://www.jb51.net/article/30128.htm

 

一 準備 
1 下載apache http://httpd.apache.org/download.cgi#apache24 httpd-2.2.22-win32-x86-openssl-0.9.8t.msi

openssl表示帶有openssl模組,利用openssl可給Apache配置SSL安全連結 

2 下載php http://windows.php.net/downloads/releases/archives/ php-5.3.5-Win32-VC6-x86.zip 

下載vc6版本 
VC6:legacy Visual Studio 6 compiler,就是使用這個編譯器編譯的。 

VC9:the Visual Studio 2008 compiler,就是用微軟的VS編輯器編譯的。 

3 下載mysql http://mysql.llarian.net/Downloads/MySQL-5.5/mysql-5.5.23-winx64.msi 

 

二 安裝 
1 apache 比較簡單,一路next完成. 

 

瀏覽器驗證,出現一下頁面,成功

2 php安裝

下載zip包,直接解壓到一個目錄,目錄重新命名為php

3 mysql 
略 

 

三 配置 
php配置 
php.ini-development 檔案重新命名為 php.ini 
指定PHP擴充包的具體目錄,以便調用相應的DLL檔案 

; Directory in which the loadable extensions (modules) reside. ; http://php.net/extension-dir ; extension_dir = "./" ; On windows: ; extension_dir = "ext" 

修改為 

; Directory in which the loadable extensions (modules) reside. ; http://php.net/extension-dir ; extension_dir = "./" ; On windows: extension_dir = "D:/servers/php/ext" 

去掉以下配置注釋,支援mysql 

代碼如下:

extension=php_curl.dll extension=php_gd2.dll extension=php_mysql.dll extension=php_pdo_mysql.dll extension=php_pdo_odbc.dll 

支援session 

session.save_path = "e:/temp" 

上傳檔案目錄配置 

upload_tmp_dir ="e:/temp" 

時區配置 

date.timezone =Asia/Shanghai 


apache配置 

進入apache安裝目錄,開啟設定檔 /conf/httpd.conf
在#LoadModule vhost_alias_module modules/mod_vhost_alias.so下添加 

LoadModule php5_module "e:/servers/php/php5apache2_2.dll" PHPIniDir "e:/servers/php" AddType application/x-httpd-php .php .html .htm 

 web主目錄修改 

DocumentRoot "D:/servers/Apache2.2/htdocs" 

改為 

DocumentRoot "D:/servers/phpweb" 

代碼如下:

<Directory "D:/servers/Apache2.2/htdocs"> 


改為 

<Directory "D:/phpweb"> 

代碼如下:


<IfModule dir_module> DirectoryIndex index.html </IfModule> 

 改為 

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

重啟apache 

mysql配置 
略 
四 測試 
建立phpweb目錄 D:\servers\phpweb 

建立測試檔案 index.php 

<?php phpinfo(); ?> 

瀏覽:http://localhost 
顯示如下資訊,說明配置成功: 

建立mysql串連測試檔案 

<?php $connect=mysql_connect("10.71.196.147","user",""); if(!$connect) echo "Mysql Connect Error!"; else echo "mysql 串連成功"; mysql_close(); ?> 

瀏覽:http://localhost/mysqltest.php 測試mysql串連

windows下apache+php+mysql 環境配置方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.