1. 安装mysql
sudo apt-get install mysql-server
2. 安装apache2
sudo apt-get intall apache2
3. 安装php5
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
重启apache2
sudo /etc/init.d/apache2 restart
在/var/www/下编译test.php
浏览器打开 http://localhost/test.php
4. 支持mysql
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
重启apache2
sudo /etc/init.d/apache2 restart
5. 相关配置说明
apache 的配置文件路径 /etc/apache2/apache2.conf
php5路径 /etc/php5/apache2/php5.ini
mysql配置文件 路径 /etc/mysql/my.cnf
默认站点配置文件 /etc/apache2/sites-enabled/000-default,基本无须修改配置,就可以支持php;
配置虚拟主机:
cd /etc/apache2/sites-available
cp default mytest
编辑mytest
<VirtualHost *:80>
DocumentRoot /var/www/mytest
ServerName mytest
其它不变
建立符号链接
ln -s mytest ../sites-enabled/mytest
sudo /etc/init.d/apache2 restart