来源:江湖人称露小缝
1>CentOS
yum install mysql mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysql_secure_installation
yum install httpd
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
yum install php
/etc/init.d/httpd restart
vi /var/www/html/info.php
在 CentOS 中
Apache 的默认根目录是 /var/www/html
配置文件 /etc/httpd/conf/httpd.conf
其他配置存储在 /etc/httpd/conf.d/
< ?php
phpinfo();
?>
yum search php
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
/etc/init.d/httpd restart
2>Ubuntu
1.安装 Apache
sudo apt-get install apache2
2.测试 Apache
3.安装 PHP5
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
4.测试 PHP
sudo gedit /var/www/testphp.php
< ?php phpinfo(); ?>
5.安装 MySQL
sudo apt-get install mysql-server
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin