Windows環(huán)境下PHP5開(kāi)發(fā)配置指南
開(kāi)發(fā)平臺(tái):
WindowsXP 下
php-5.1.6-Win32
mysql-5.0.18-win32
Smarty-2.6.14
Date-1.4.6.tar
DB-1.7.6.tar
MDB2-2.3.0.tar
Validate-0.6.5.tar
DB_DataObject-1.8.4.tar
工具:
phpMyAdmin-2.9.0.2
一、PHP的安裝與配置
PHP配置步驟
1、PHP5的下載和安裝
將解壓縮后的php-5.1.6-Win32中的文件拷貝到C:/php5/下面。
2、配置PHP
a>復(fù)制 C:/PHP5/目錄下的 php5ts.dll 文件到C:/WINDOWS/system32目錄中。
b>將C:/PHP5/目錄下的php.ini-recommended文件拷貝到c:/WINDOWS中,并改名為php.ini。
注意:如果使用了 NTFS,確保運(yùn)行webserver 的用戶(hù)對(duì) php.ini 有讀取的權(quán)限(例如使其對(duì)Everyone 可讀,需將c:/WINDOWS設(shè)置為WEB共享)。
c>加載對(duì)http://localhost/phpMyAdmin/
四、smarty的配置
1、安裝
在D:/www/test下新建目錄comm。
從http://smarty.php.net/do_download.php下載最新包,將libs中所有文件拷入comm目錄,完成基本安裝。
2、配置
在D:/www/test下新建目錄cache、config、templates、templates_c
在D:/www/test下新建PHP程序文件index.php。如下:
<?php
require 'comm/Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = 'templates';
$smarty->compile_dir = 'templates_c';
$smarty->config_dir = 'config';
$smarty->cache_dir = 'cache';
$smarty->caching = false;
$smarty->left_delimiter = "<!--";
$smarty->right_delimiter = "-->";
$var = 'Hello World!';
$smarty->assign('hello',$var);
$smarty->display('index.tpl');
?>
在D:/www/test/ templates下新建http://localhost/test/index.php
done...
五、DataObject的配置
1、下載
DataObject是PEAR的一部分。它與另外4個(gè)模塊相關(guān)。所以在安裝它之前,要先安裝PEAR,然后安裝其他4個(gè)模塊:DB、DATE、MDB2、和Validate。如果是PHP5安裝包的話,在C:/PHP5/ 目錄下會(huì)帶有g(shù)o-pear.bat工具。點(diǎn)擊運(yùn)行它,然后在C:/PHP5/目錄下會(huì)看到pear.bat(真多余,但沒(méi)辦法。。。)
到http://pear.php.net/packages.php下載5個(gè)包,我下的是DB-1.7.6.tar、Date-1.4.6.tar、MDB2-2.3.0.tar、Validate-0.6.5.tar和DB_DataObject-1.8.4.tar。拷貝到C:/PHP5/ 目錄下。這里面,我們要用到的DB_DataObject包必須最后安裝。
2、安裝
依次安裝DB、DATE、MDB2、和Validate,最后是DataObject。
在命令行模式下,轉(zhuǎn)到C:/PHP5/。運(yùn)行:
Pear install DB-1.7.6.tar
Pear install Date-1.4.6.tar
Pear install MDB2-2.3.0.tar
Pear install Validate-0.6.5.tar
Pear install DB_DataObject-1.8.4.tar
OK!
3、配置
我的http://localhost/test/test.php
OK! …
新聞熱點(diǎn)
疑難解答
圖片精選