PHPçè¿è¡ç¯å¢ä¸é¾é
ç½®!ä¸é¢æ¯ä¸ªæ¡ä¾:
PHPå¼åç¯å¢é
ç½®(Windowsç)
Apache+MySQL+PHP+phpMyAdmin
ç³»ç»:Windows XP
Step1:ä¸è½½ä»¥ä¸æ件
(1)php-5.2.0-Win32.zip
pecl-5.2.0-Win32.zip
(2)apache_2.2.3-win32-x86-no_ssl.msi
(3)mysql-5.1.12-beta-win32.zip
(4)phpMyAdmin-2.9.1.1-all-languages.zip
Step2:å®è£
PHP, é
ç½®php.ini
æ两ç§æ¹æ³å¨ Windowsä¸å®è£
PHPï¼æå·¥å®è£
æè
使ç¨å®è£
ç¨åºå®è£
ãèªå¨å®è£
çå®è£
ç¨åºphp-5.2.0-win32-installer.msiä¸å
å«ä»»ä½å¤é¨çPHPæ©å±ï¼PHP_*.dllï¼ãå¦æéè¦ï¼å¯ä»¥å¨ Windows ZIP å
å PECL ä¸æ¾å°ãæ®PHPå®æ¹æåä¸ç§°å®è£
PHP æ好çéæ©æ¯æå·¥å®è£
ãå¨æå·¥å®è£
ä¸å®è£
PHP æ好çæ¹å¼ä¾¿æ¯å°ææ PHP æå
³çæ件é½æ¾å
¥åä¸ç®å½ï¼å¹¶å¨ç³»ç»ç PATH ç¯å¢åéä¸è®¾ç½®æ¤ç®å½ãæ¬ä¾ä¸ºæå·¥å®è£
.
1. å°ä¸è½½çphp-5.2.0-Win32.zip解åå°C:\PHP\ è¿ä¸ªç®å½.
2. åå°C:\PHP\ ç®å½ä¸ç*.dllå C:\PHP\extç®å½ä¸çæææ件æ件å¤å¶ç²è´´å°C:\windows\system32\ä¸.
å¦æéè¦æ´å¤æ©å±,å°±å°pecl-5.2.0-Win32.zipä¸çæ件ä¹æ¾å°C:\windows\system32\ä¸.
3. é
ç½®php.iniã
å¨ZIP å
ä¸æ两个iniæ件,php.ini-diståphp.ini-recommendedãå»ºè®®ä½¿ç¨ php.ini-recommendedï¼å 为å¨è¯¥æ件ä¸ä¼åäºæ§è½åå®å
¨ãå¤å¶æéæ©ç ini æä»¶å° PHP è½æ¾å°çç®å½ä¸ï¼å¹¶å°å
¶éå½å为 php.ini ã
åç¨è®°äºæ¬æå¼ php.ini ï¼æ¥æ¾register_globals = Offï¼æoffæ¹æOn.
åæ¥æ¾short_open_tag = Off,æoffæ¹æOnæä¸å¤.
åæ¥æ¾extension_dir = "./" æ¹ä¸º extension_dir = "C:\PHP\ext"
ç¶ååæ¥æ¾;extension=php_mbstring.dll,æåé¢çåå·å»æ.
extension=php_mbstring.dll(ä¸éè¿ä¸ªphpMyAdminä¼é)
以ä¸å 个dllä½ç¸åæ´æ¹.
extension=php_dba.dll
extension=php_dbase.dll
extension=php_filepro.dll å¯é
extension=php_gd2.dll æ¯æGDåºçï¼ä¸è¬è¦é
extension=php_imap.dll å¯é
extension=php_ldap.dll
extension=php_mysql.dll æ¯æMySQLç
æ¥ä¸æ¥ä¿®æ¹äºä¸äºæ件ä¸ä¼ 以åå
å使ç¨æ大éå¶ï¼
memory_limit = 20M ;å
å容é
post_max_size = 20M ;éªå容é
upload_max_filesize = 20M ; é件容é
asp_tags = On ;å¯é,Onå
许ASPé£æ ¼çæ è®°,Offç¦æ¢
4. å° PHP ç®å½æ·»å å° PATH ç¯å¢åéä¸
ç³»ç»ç¯å¢åépath=C:\php
5. 使 php.ini æä»¶å¨ Windowsä¸è¢« PHP æç¨
ç³»ç»ç¯å¢åéPHPRC=C:\php
Step3: å®è£
Apache,é
ç½® httpd.conf 使ä¹æ¯æPHP
1.å®è£
apache_2.2.3-win32-x86-no_ssl.msi,ä¸è·¯æNextå³å¯.
å®è£
å®æåè¾å
¥[url]
http://localhost[/url] æ¥çApacheæ¯å¦å®è£
æå.
(å¦æå®è£
äºIIS请å
³é,æè
请æ¹åå®è£
端å£,ä¸ç¶æ æ³å¯å¨Apacheæå¡)
2. æå¼æ件C:\Apache2\conf\httpd.conf,æ¥æ¾ä»¥ä¸è®¾ç½®é¡¹.
å³æ³¨åæ件åç¼.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
AddType application/x-httpd-php .php .phtml .php3 .php4
AddType application/x-httpd-php-source .phps
</Directory>
绿è²ä¸ºæ们æ°å¢ç设置.
3.æ¥æ¾LoadModule模å
LoadModule php5_module "C:/ php/php5apache2_2.dll"
注æææ æ¹åä¸Windowsä¸è·¯å¾â\âç¸å.
4.æ¥æ¾ä»¥ä¸,并å¢å index.php
æ ¹æ®éè¦è¿å¯ä»¥å¢å å
¶å®èªå®ä¹é¦é¡µå¦index.htm
<IfModule dir_module>
DirectoryIndex index.html index.html.var index.php
</IfModule>
5. æ¥æ¾ Documentroot "C:/Apache2/htdocs" å°å
¶æ¹ä¸ºä½ çWEBè·¯å¾; (è¿éæ¯WEB主ç®å½,å¯ä»¥ä¸ä¿®æ¹)
6.éå¯apache.
7. å¨webæ ¹ç®å½ C:\Apache2\htdocs\ ä¸æ°å»ºindex.php,å
容å¦ä¸:
<?php
phpinfo();
?>
å¨æµè§å¨ä¸è¾å
¥URL: [url]
http://localhost/index.php[/url] æµè¯ç»æ.
å¦æä¸è½æ£å¸¸è¿è¡,请æ£æ¥é
ç½®.
Step4: å®è£
MySQL
MySQLå®è£
è¿ç¨
注æ:å®è£
ä¸,ä¸å®è¦æ£ç¡®é
ç½®MySQL Server
å®è£
å®æå,æ°å»ºconn.php
<?php
$link=mysql_connect('localhost','root','root');
if(!$link) echo "MySQL æ°æ®åºè¿æ¥å¤±è´¥";
else echo "MySQL æ°æ®åºè¿æ¥æå!";
mysql_close();
?>
è¿è¡è¯¥æ件,æµè¯æ°æ®åºè¿æ¥.
Step5:å®è£
phpMyAdminé
ç½®config.inc.php
phpMyAdmin并ä¸æ¯å¿
éç,åªæ¯ä¸ºäºæ¹ä¾¿ç®¡çMySQLæ°æ®åº,æ¬èº«æ¯ç¨PHPç¼åèæ.ä½æ¯æäºå®,ä¼å¤§æ¹ä¾¿MySQLæ°æ®åºç®¡ç.
1. 解åphpMyAdmin-2.9.1.1-all-languages.zipå°C:\phpMyAdmin
2. å°C:\phpMyAdmin\config.sample.inc.phpéå½å为config.inc.php
3. 对ç
§åæ件è¿è¡å¦ä¸æ´æ¹,绿è²ä¸ºæ°å¢ç.
$cfg['blowfish_secret'] = 'root';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'root';
4. å°C:\phpMyAdmin\ä¸æææ件åç®å½å¤å¶å°
C:\Apache\htdocs\phpMyAdmin,
å¨æµè§å¨ä¸è¾å
¥[url]
http://localhost/phpMyAdmin/index.php[/url]è¿è¡æµè¯