首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 相關知識

PHP 3 從原始碼編譯安裝於 Unix/Linux 完整步驟

     編輯:PHP 相關知識

前置需求

  • 基本 Unix 操作與 C 編譯器
  • ANSI C 編譯器 (gcc)
  • Web Server (Apache)

快速安裝(Apache 模組模式)

# 1. 取得原始碼
wget https://www.php.net/distributions/php-3.0.x.tar.gz
wget https://apache.mirror/httpd-1.3.x.tar.gz

# 2. 解壓
gunzip apache_1.3.x.tar.gz && tar xvf apache_1.3.x.tar
gunzip php-3.0.x.tar.gz && tar xvf php-3.0.x.tar

# 3. 配置 Apache
cd apache_1.3.x
./configure --prefix=/www

# 4. 配置 PHP(指定 Apache 來源路徑)
cd ../php-3.0.x
./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars

# 5. 編譯安裝 PHP
make && make install

# 6. 重新編譯 Apache 載入 PHP 模組
cd ../apache_1.3.x
./configure --prefix=/www --activate-module=src/modules/php3/libphp3.a
make && make install
# 或直接覆蓋 httpd 二進制檔(需先停止服務)

# 7. 複製 php.ini
cp php3.ini-dist /usr/local/lib/php3.ini

# 8. 修改 httpd.conf / srm.conf
AddType application/x-httpd-php3 .php3

# 9. 重啟 Apache(必須 stop/start,非 reload)
/www/bin/apachectl stop && /www/bin/apachectl start

關鍵提醒

  • --enable-track-vars 開啟 $HTTP_GET_VARS 等(現代 PHP 預設開啟)
  • Apache 必須完整重啟以載入新模組
  • PHP 3 年代文件,現代請參考 PHP 7/8 官方安裝文件
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved