三步解決搭建PHP環(huán)境問題
進(jìn)行正確的搭建PHP環(huán)境的方法步驟,才能保證我們變成的順利實(shí)現(xiàn)。下面我們將為大家介紹有關(guān)搭建PHP環(huán)境的相關(guān)方法,希望對大家有所幫助。#t#
搭建PHP環(huán)境一、安裝Apache 2.2.x
下載地址:http://httpd.apache.org/
一路回車即可安裝。 注意安裝完成后要執(zhí)行:D:\Apache2.2\bin>httpd -k install
假設(shè),安裝在D:\盤下。
Installing the Apache2.2 service
The Apache2.2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
httpd: Could not reliably determine the server's fully qualified domain name, us
ing 192.168.28.100 for ServerName
執(zhí)行后,在桌面右下腳打開Monitor Apache Servers 并啟動Apache 2.2服務(wù)
搭建PHP環(huán)境二、安裝PHP
下載地址:http://cn2.php.net/get/php-4.4.9-Win32.zip/from/a/mirror
下載 php-5.2.6-Win32.zip
(1)將PHP文件解壓到一個目錄下,目錄地址為 "D:\php"。
(2)將PHP目錄(D:\php)下的php.ini-dist復(fù)制到windows(有的系統(tǒng)是winnt目錄)目錄下,并改名為php.ini。
(3)復(fù)制D:\php目錄下的所有dll文件到windows的系統(tǒng)文件夾里,即:C:\windows\system32。
注意:如果不想復(fù)制(3)的文件,可以把 D:\php 目錄加入系統(tǒng)PATH變量中
搭建PHP環(huán)境三、Apache 與 PHP 的整合
開始菜單的程序的Apache HTTP Server 2.2.4,再進(jìn)入下一級的Configure Apache Server,這時(shí)可以看到那個Edit the Apache httpd.conf Configuration File。點(diǎn)一下。
查找:
#LoadModule ssl_module modules/mod_ssl.so
在下面添加:
LoadModule php5_module "d:/local/php/php5apache2_2.dll"
查找:
DirectoryIndex index.html
替換:
DirectoryIndex index.html index.htm index.php default.php
查找:
AddType application/x-gzip .gz .tgz
在下面添加:
AddType application/x-httpd-php .php
Apache配置結(jié)束,現(xiàn)在開始進(jìn)行PHP配置,用Notepad打開C:\windows\php.ini。
查找:
extension_dir = "./"
替換:
extension_dir = "d:/local/php/ext/"
查找:
upload_max_filesize = 2M
這里的意思為修改上傳文件的最大限制,默認(rèn)為2M,可以改為6M。
查找:
;extension=php_mbstring.dll
將前面的;號去掉。
查找:
;extension=php_gd2.dll
將前面的;號去掉。
查找:
;extension=mysql.dll
將前面的;號去掉。
查找:
;date.timezone =
替換:
date.timezone = PRC
文件修改完畢,此時(shí),雙擊右下角任務(wù)欄的Apache圖標(biāo),彈出的窗口中,點(diǎn)Stop停止服務(wù),等停止后再點(diǎn)Start啟動服務(wù),此時(shí),可以看到其窗口的狀態(tài)欄中會顯示:"Apache/2.2.4 (Win32) PHP/5.2.0"。搭建PHP環(huán)境的配置全部完成。