1. 程式人生 > >php開發環境配置(windows+apache+msql+php)wamp,不區分32位還是64位,都可以用的

php開發環境配置(windows+apache+msql+php)wamp,不區分32位還是64位,都可以用的

php 配置檔案,需要反註釋掉:extension_dir = "ext"

開啟需要用到的擴充套件,比如mbstring php_mysql 等等

設定時區,比方說設定成上海的時區:     date.timezone = "Asia/Shanghai"

要將php加入環境變數

apache配置檔案:

加入:

LoadModule php5_module "D:/ProgramFiles/php/php5apache2_2.dll"
PhpIniDir "D:/ProgramFiles/php"

第二行作用:指定php.ini的位置

更改web伺服器根目錄:

DocumentRoot "D:/www"

<Directory "原始目錄">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

改為:

<Directory "D:/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

將以下程式碼

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

改為:

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

查詢AddType關鍵字,加入:

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

將.php .html字尾的檔案採用php的方式解析

最後,可以設定虛擬主機:

<VirtualHost 127.0.0.10>
DocumentRoot D:/www/phpMyAdmin
ServerName www.phpmyadmin.local
</VirtualHost>

apache更改配置檔案後,可能由於配置錯誤無法啟動,檢視錯誤行數的方法為:

在config apache  server中,選擇Test Configuration來檢視錯誤

可以把php目錄加入環境變數,以在命令列中使用php命令來測試php指令碼

可以把mysql server目錄中的子目錄bin放入環境變數,這樣可以在命令列中使用 mysql -u root -p   來登入mysql server.