1.安装apache2
- sudo apt-get install apache2
sudo apt-get install apache2
Apache安装成功后,/var/www/默认作为web的根目录,所有web资源都应该放在该目录或其子目录中。
2.安装PHP5并测试
- sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5 libapache2-mod-php5
新建/var/www/phptest.php文件,文件内容如下:
<?php phpinfo(); ?>
在浏览器中输入以下网址:
- http://localhost/phptest.php
http://localhost/phptest.php
如果打开了php信息页面,则说明一切正常。
3.安装MySQL5
- sudo apt-get install mysql-server
sudo apt-get install mysql-server
4.安装MySQL Administrator
- sudo apt-get install mysql-admin
sudo apt-get install mysql-admin
5.安装phpmyadmin并进行相关配置
- sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
- sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/phpmyadmin
- cd /etc/apache2/sites-enabled/
- sudo ln -s ../sites-available/phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/phpmyadmin
cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/phpmyadmin
重启apache2
- sudo /etc/init.d/apache2 restart
sudo /etc/init.d/apache2 restart
在浏览器中输入以下网址:
- http://localhost/phpmyadmin
http://localhost/phpmyadmin
如果出现了phpMyAdmin的登录界面,则表示配置成功,接下来就可以对数据库进行操作了。