用 Google 搜尋:

php 安裝設定教學

php 安裝設定教學

官方網站:http://www.php.net/

實作版本下載點:
php 4.x:http://tw.php.net/distributions/php-4.4.2-Win32.zip
php 5.x:http://tw.php.net/distributions/php-5.1.1-installer.exehttp://tw.php.net/distributions/php-5.1.1-Win32.zip

功能:伺服器端的程式語言,可產生動態網頁,並可搭配 MySQL 資料庫儲存並管理資料。

php 4.x 與 php 5.x 還是有相容性上的問題,如果完全沒有舊程式的包袱,建議一開始就可以安裝 php 5.x 版了。但如果有使用到某些 blog 系統、論壇等等的,可能得要 php 4.x 才能夠正常執行喔!

以下的安裝步驟將分為 4.x 與 5.x 兩種不同的版本說明。

php 4.x 篇

安裝步驟

  1. 將 php-4.4.2-Win32.zip 解壓縮至 C:\PHP 資料夾。
  2. 複製 php.ini-recommended 到 %SYSTEMROOT% 資料夾下並改名為 php.ini。
  3. 複製 C:\PHP\sapi\php4apache2.dll 到 C:\PHP。
  4. 複製 C:\PHP\libeay32.dll 與 C:\PHP\ssleay32.dll 至 %SYSTEMROOT%\System32 資料夾。
  5. 就是這麼簡單,接下來設定的部分請參考 php 5.x 的說明即可。

php 5.x 篇

安裝步驟

  1. 下載並執行 php-5.1.1-installer.exe。
  2. 安裝程式起始(Installation Wizard)畫面:
    • 直接按 Next。
  3. 使用許可協議(License Agreement)畫面:
    • 按 I Agree。
  4. 讀我檔案(Read This First)畫面:
    • 直接按 Next。
  5. 安裝類型選擇(Installation Type)畫面:
    • 點選 Standard。
    • 按 Next。
  6. 安裝目錄設定(Choose Destination Location)畫面:
    • 直接按 Next。
  7. 郵件設定(Mail Configuration)畫面:
    • SMTP Server 請依照 ISP 提供的資料設定。
    • 'From' Address fot the Mail 請填自己的 Email 信箱。
    • 按 Next。
  8. 伺服器類型選擇(Server Type)畫面:
    • 點選 Apache。
    • 按 Next。
  9. 準備開始安裝(Start Installation)畫面:
    • 直接按 Next。
  10. Apache 設定(Apache Configuration)畫面:
    • 若出現此訊息可先按 OK 略過,稍後再進行設定。
  11. 安裝完成(Installation Complete)畫面:
    • 按 OK。
    • 安裝成功。
  12. 解壓縮 php-5.1.1-Win32.zip 至 C:\PHP 資料夾,並覆蓋所有檔案。
  13. 複製 C:\PHP\libeay32.dll 與 C:\PHP\ssleay32.dll 至 %SYSTEMROOT%\System32 資料夾。

設定步驟

php.ini 設定

用記事本開啟 %SystemRoot%\php.ini,並按照以下原則進行修改。

請自行以關鍵字尋找並取代預設設定,若沒有預設設定則新增在檔案最後面即可。

強調的部分請依實際情況修改。

請注意斜線(/)與反斜線(\)的不同,以免造成不必要的錯誤。

設定完成後必須重新啟動伺服器以套用新的設定。

httpd.conf 設定

用記事本開啟 C:\Program Files\Apache Group\Apache2\conf\httpd.conf,並按照以下原則進行修改。

請自行以關鍵字尋找並取代預設設定,若沒有預設設定則新增在檔案最後面即可。

強調的部分請依實際情況修改。

請注意斜線(/)與反斜線(\)的不同,以免造成不必要的錯誤。

設定完成後必須重新啟動伺服器以套用新的設定。

附錄 - PHP Extensions 說明

摘錄自 Installation of extensions on Windows

ExtensionDescriptionNotes
php_bz2.dllbzip2 compression functionsNone
php_calendar.dllCalendar conversion functionsBuilt in since PHP 4.0.3
php_cpdf.dllClibPDF functionsNone
php_crack.dllCrack functionsNone
php_ctype.dllctype family functionsBuilt in since PHP 4.3.0
php_curl.dllCURL, Client URL library functionsRequires: libeay32.dll, ssleay32.dll (bundled)
php_cybercash.dllCybercash payment functionsPHP <= 4.2.0
php_db.dllDBM functionsDeprecated. Use DBA instead (php_dba.dll)
php_dba.dllDBA: DataBase (dbm-style) Abstraction layer functionsNone
php_dbase.dlldBase functionsNone
php_dbx.dlldbx functions
php_domxml.dllDOM XML functionsPHP <= 4.2.0 requires: libxml2.dll (bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)
php_dotnet.dll.NET functionsPHP <= 4.1.1
php_exif.dllEXIF functionsphp_mbstring.dll. And, php_exif.dll must be loaded after php_mbstring.dll in php.ini.
php_fbsql.dllFrontBase functionsPHP <= 4.2.0
php_fdf.dllFDF: Forms Data Format functions.Requires: fdftk.dll (bundled)
php_filepro.dllfilePro functionsRead-only access
php_ftp.dllFTP functionsBuilt-in since PHP 4.0.3
php_gd.dllGD library image functionsRemoved in PHP 4.3.2. Also note that truecolor functions are not available in GD1, instead, use php_gd2.dll.
php_gd2.dllGD library image functionsGD2
php_gettext.dllGettext functionsPHP <= 4.2.0 requires gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll, iconv.dll (bundled).
php_hyperwave.dllHyperWave functionsNone
php_iconv.dllICONV characterset conversionRequires: iconv-1.3.dll (bundled), PHP >=4.2.1 iconv.dll
php_ifx.dllInformix functionsRequires: Informix libraries
php_iisfunc.dllIIS management functionsNone
php_imap.dllIMAP POP3 and NNTP functionsNone
php_ingres.dllIngres II functionsRequires: Ingres II libraries
php_interbase.dllInterBase functionsRequires: gds32.dll (bundled)
php_java.dllJava functionsPHP <= 4.0.6 requires: jvm.dll (bundled)
php_ldap.dllLDAP functionsPHP <= 4.2.0 requires libsasl.dll (bundled), PHP >= 4.3.0 requires libeay32.dll, ssleay32.dll (bundled)
php_mbstring.dllMulti-Byte String functionsNone
php_mcrypt.dllMcrypt Encryption functionsRequires: libmcrypt.dll
php_mhash.dllMhash functionsPHP >= 4.3.0 requires: libmhash.dll (bundled)
php_mime_magic.dllMimetype functionsRequires: magic.mime (bundled)
php_ming.dllMing functions for FlashNone
php_msql.dllmSQL functionsRequires: msql.dll (bundled)
php_mssql.dllMSSQL functionsRequires: ntwdblib.dll (bundled)
php_mysql.dllMySQL functionsPHP >= 5.0.0, requires libmysql.dll (bundled)
php_mysqli.dllMySQLi functionsPHP >= 5.0.0, requires libmysql.dll (libmysqli.dll in PHP <= 5.0.2) (bundled)
php_oci8.dllOracle 8 functionsRequires: Oracle 8.1+ client libraries
php_openssl.dllOpenSSL functionsRequires: libeay32.dll (bundled)
php_oracle.dllOracle functionsRequires: Oracle 7 client libraries
php_overload.dllObject overloading functionsBuilt in since PHP 4.3.0
php_pdf.dllPDF functionsNone
php_pgsql.dllPostgreSQL functionsNone
php_printer.dllPrinter functionsNone
php_shmop.dllShared Memory functionsNone
php_snmp.dllSNMP get and walk functionsNT only!
php_soap.dllSOAP functionsPHP >= 5.0.0
php_sockets.dllSocket functionsNone
php_sybase_ct.dllSybase functionsRequires: Sybase client libraries
php_tidy.dllTidy functionsPHP >= 5.0.0
php_tokenizer.dllTokenizer functionsBuilt in since PHP 4.3.0
php_w32api.dllW32api functionsNone
php_xmlrpc.dllXML-RPC functionsPHP >= 4.2.1 requires: iconv.dll (bundled)
php_xslt.dllXSLT functionsPHP <= 4.2.0 requires sablot.dll, expat.dll (bundled). PHP >= 4.2.1 requires sablot.dll, expat.dll, iconv.dll (bundled).
php_yaz.dllYAZ functionsRequires: yaz.dll (bundled)
php_zip.dllZip File functionsRead only access
php_zlib.dllZLib compression functionsBuilt in since PHP 4.3.0