FreeLAMP 組合成熟穩定、社群龐大、授權自由。PHP 發展迅猛、MySQL 輕量高效、Apache 佔據過半市場份額,是 Web 開發首選組合。
apt-get install apache php4 php4-gd php4-mysql mysql-server mysql-client
php4-gd:動態圖片處理(驗證碼、圖表),不需可不裝。apacheconfig 腳本?選 Yes(自動生成基礎配置)。gd.so、mysql.so 寫入 php.ini?選 Yes。LoadModule php4_module /usr/lib/apache/1.3/libphp4.soDirectoryIndex index.php index.php3 index.html index.htm index.shtml index.cgi
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
AddDefaultCharset gb2312(簡體中文環境)。apachectl restart 或 /etc/init.d/apache restart。mysqladmin password 'your_strong_password'
# 驗證
mysqladmin version -u root -p
/etc/mysql/my.cnf,註解 skip-networking。警告:僅在受信任內網或配合防火牆限制來源 IP 時開放。/etc/init.d/mysql,啟動參數加入 --default-character-set=gb2312,重啟 MySQL。default_charset = "gb2312"
取消註解並修改,重啟 Apache 生效。
mytest、資料表 user (username, password, birthdate, active)。mytest.php 放入 /var/www (Apache DocumentRoot)。https://server_ip/mytest.php,正常顯示分頁資料表即成功。links:支援選單 (Esc 鍵)、表單、表格渲染佳,適合新手。lynx、w3m:輕量、鍵盤操作導向。本文為第一章,後續將涵蓋:
提問與交流歡迎聯繫作者 kanaka。祝架站順利!