LAMP(Linux + Apache + MySQL + PHP/Perl/Python)被稱為 PHP 開發的黃金組合,而在 Ubuntu 上把它架起來,幾乎不需要手動拼裝。
開「系統 → 系統管理 → 新立得套件管理器」,在「編輯」選單裡挑「使用任務分組標記套件」,勾選 LAMP Server 並套用。
同樣在新立得裡搜尋 phpmyadmin 標記安裝,或直接:
sudo apt-get install phpmyadmin
接著把它和 Apache 的網站根目錄做連結(以下以 /home/dreamcatcher/www 為例):
sudo ln -s /usr/share/phpmyadmin /home/dreamcatcher/www
如此就能用 https://localhost/phpmyadmin 進入。
sudo a2enmod rewrite
編輯 /etc/apache2/apache2.conf,在檔案後面加上:
AddType application/x-httpd-php .php .htm .html
AddDefaultCharset UTF-8
若你的內容是簡中,把 UTF-8 換成 gb2312 即可,這也能解掉 Firefox 的亂碼問題。
sudo /etc/init.d/apache2 restart
MySQL 則用 mysql -u root -p 登入。
若重啟時看到 Could not reliably determine the server's fully qualified domain name,在同一個設定檔尾端補一行 ServerName 127.0.0.1 就安靜了。
sudo /etc/init.d/apache2 restart(重啟 Apache)
sudo gedit /etc/php5/apache2/php.ini(PHP 設定)
sudo gedit /etc/apache2/apache2.conf(Apache 設定)
/var/www/cgi-bin/(CGI 程式)