1.先將Ubuntu系統的apt更新
sudo apt-get update
2.安裝apache2
sudo apt-get install apache2
3.安裝MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
4.初始化MySQL並設定安全性
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
Enter current password for root (enter for none):請輸入MySQL root的密碼
OK, successfully used password, moving on...
Remove anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Success!
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
5.安裝PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
6.將index.php加到網站目錄的預設文件中
sudo vi /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
7.安裝PHP模組
apt-cache search php5-
php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 module development
php5-gd - GD module for php5
php5-gmp - GMP module for php5
php5-ldap - LDAP module for php5
php5-mysql - MySQL module for php5
php5-odbc - ODBC module for php5
php5-pgsql - PostgreSQL module for php5
php5-pspell - pspell module for php5
php5-recode - recode module for php5
php5-snmp - SNMP module for php
php5-sqlite - SQLite module for php5
php5-tidy - tidy module for php5
php5-xmlrpc - XML-RPC module for php5
php5-xsl - XSL module for php5
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-auth-pam - A PHP5 extension for PAM authentication
[...]
sudo apt-get install name of the module
8.驗證安裝結果,在網站目錄內開個PHP檔案,將下面程式碼加進去,儲存後使用瀏覽器確認安裝成功了嗎.
<?php
phpinfo();
?>
\
留言列表