PHP安裝使用手冊

一、概述:

  PHP為Personal Homepage Program的縮寫,從原始的手冊中提到「PHP is a server-side, cross-platform, HTML embedded scripting language.」就可以知道PHP是在伺服器端的跨平台HTML內嵌式描述語言。
  PHP是一種描述(script)語言,就跟VB script、ASP(Active Server Page)、Java script一樣,是屬於直譯式的電腦語言。
  PHP強調在Server端的計算、文字處理、檔案等,最大的特點是具有眾多的資料庫連結能力,能輕易地將Web與Database相結合,因此目前在網路上正蓬勃地快速發展!

二、資源:

三、安裝

  1. 取得最新版apache-1.3.9套件

  2. 您可從Redhat 6.1光碟片中或ftp到各大FTP站將Redhat 6.1的apache-1.3.9套件下載回來。
     
  3. apache-1.3.9套件列表:
  4. -rw-r--r--   1 root     ftp        833084 Nov 11 18:03 apache-1.3.9-4.i386.rpm
    -rw-r--r--   1 root     ftp       1547940 Nov 11 18:03 apache-1.3.9-4.src.rpm
    -rw-r--r--   1 root     ftp         91676 Nov 11 18:03 apache-devel-1.3.9-4.i386.rpm
     
  5. 將原有之apache-1.3.6升級到apache-1.3.9
  6. [root@test /root]# rpm -Uvh apache-1.3.9-4.i386.rpm
    [root@test /root]# rpm -Uvh apache-devel-1.3.9-4.i386.rpm
     
  7. 取得 php 3.0.12 套件:

  8. 您可從上一節檔案來源之任意一站取得套件。
     
  9. mod_php3-3.0.12套件檔案列表:
  10. -rw-r--r--   1 root     ftp        269954 Nov 11 18:03 mod_php3-3.0.12-1cc.i386.rpm
    -rw-r--r--   1 root     ftp       3968349 Nov 11 18:03 mod_php3-3.0.12-1cc.i386.rpm
    -rw-r--r--   1 root     ftp        312613 Nov 11 18:03 mod_php3-imap-3.0.12-1cc.i386.rpm
    -rw-r--r--   1 root     ftp        608671 Nov 11 18:03 mod_php3-manual-3.0.12-1cc.i386.rpm
    -rw-r--r--   1 root     ftp         36097 Nov 11 18:03 mod_php3-mysql-3.0.12-1cc.i386.rpm
    -rw-r--r--   1 root     ftp         13263 Nov 11 18:03 mod_php3-pgsql-3.0.12-1cc.i386.rpm
     
  11. 依下列順序安裝PHP3所需套件:
  12. [root@test /root]# rpm -ivh mod-php3-3.0.12-1cc.i386.rpm
    [root@test /root]# rpm -ivh mod-php3-imap-3.0.12-1cc.i386.rpm
    [root@test /root]# rpm -ivh mod-php3-manual-3.0.12-1cc.i386.rpm
    [root@test /root]# rpm -ivh mod-php3-mysql-3.0.12-1cc.i386.rpm
     
  13. 修改 apache 設定檔 httpd.conf
  14. [root@test /root]#cd /etc/httpd/conf/
    [root@test /conf]# vi httpd.conf
    第67行-->#LoadModule php3_module        modules/libphp3.so
     改成-->LoadModule php3_module        modules/libphp3.so

    第113行-->#AddModule mod_php3.c
     改成-->AddModule mod_php3.c
     

  15. 修改 apache 設定檔 srm.conf
  16. [root@test /root]#cd /etc/httpd/conf/
    [root@test /conf]# vi httpd.conf
    第30行-->DirectoryIndex index.html index.shtml index.cgi
      改成-->DirectoryIndex index.html index.shtml index.cgi index.php3 index.php
    (php 4.0版副檔名改成.php,故除了增加index.php3外,另增加index.php,為4.0版預做準備)

    第164行-->#AddType application/x-httpd-php3 .php3
     改成--->AddType application/x-httpd-php3 .php3
     
    並增加 AddType application/x-httpd-php3 .php (為4.0版預做準備)
        AddType application/x-httpd-php3 .inc (為php語言中引入檔的副檔名,同樣也是由php語法寫成)
        AddType application/x-httpd-php3 .phtml (3.0版之前之習慣用法)

    第165行-->#AddType application/x-httpd-php3-source .phps
     改成--->AddType application/x-httpd-php3-source .phps
     

  17. 重新啟動 apache:
  18. [root@test conf]# /etc/rc.d/init.d/httpd restart
    Shutting down http:                                        [  OK  ]
    Starting httpd:                                            [  OK  ]
  19. 觀看 apache 的 log 檔,看 apache 是否正常啟動。
  20. [root@test conf]# tail /var/log/httpd/error_log
    [Wed Aug 18 22:52:47 1999] [notice] caught SIGTERM, shutting down
    [Wed Aug 18 22:52:49 1999] [notice] Apache/1.3.9 (Unix)  (Red Hat/Linux) PHP/3.0
    .12 configured -- resuming normal operations
    [Wed Aug 18 22:52:52 1999] [notice] su EXEC mechanism enabled (wrapper: /usr/sbin/suexec)