一、Ubuntu下安装
1、安装Apache
sudo apt-get install apache2
2、安装php
sudo apt-get install php5
3、让Apache支持php
sudo apt-get install php5 libapche2-mod-php5
4、重启Apache
sudo /etc/init.d/apache2 restart
5、安装mysql服务
sudo apt-get install mysql-server
6、让php支持mysql
sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
7、重启Apache
sudo /etc/init.d/apache2 restart
二、centOS下安装
1、安装Apache
yum install httpd-devel
2、启动Apache
/etc/init.d/httpd start
(注意:如果启动失败,试着使用/bin/systemctl strat httpd.service)
3、安装mysql
yum install nysql mysql-server
4、启动mysql
/etc/init.d/mysqld start
5、安装php
yum install php php-devel
6、重启Apache使PHP生效
/etc/init.d/httpd start
7、安装php扩展
yum install php-mysql php-gd php-imap php-odbc php-pear php-xml php-xmlrpc
安装完后重启Apache