1.安装服务器、数据库以及PHP
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
2. 安装相应的配置项
sudo apt-get install libapache2-mod-php5
sudo apt-get install php5-mysql
sudo apt-get install php5-gd
3. 重启Apache服务器
sudo /etc/init.d/apache2 restart
4 .测试
cd /var
cd www
gedit test.php
代码:
<?php echo "hello world"; ?>
打开http://127.0.0.1/test.php,结果显示 hello world