#########################yum源搭建LAMP########################################
1、安装包:
yum install -y httpd httpd-devel mysql mysql-server mysql-devel php php-devel php-mysql
目录路径:/var/www/html
2、关闭iptables:(或在规则中开放80端口)
service iptables stop
3、为mysql设置密码:
进入mysql
use mysql;
update user set password=password('123') where user='root';
flush privileges;
4、编辑测试页面:vi test.php
<?php
$link=mysql_connect('localhost','root','123');
if(!$link) echo "fail";
else echo "success";
mysql_close();
phpinfo();
?>
5、测试
http://192.168.137.128/test.php
第一排显示成功说明正常连接到mysql
#########################源码搭建LAMP########################################
源码包:
httpd-2.2.22.tar.gz http://download.csdn.net/download/morre/4056522
MySQL-5.5.24.tar.gz http://download.csdn.net/download/yang_xu_1987/9960273
cmake-2.8.9.tar.gz http://download.csdn.net/download/yang_xu_1987/9960268
php-5.3.22.tar.gz http://download.csdn.net/download/yang_xu_1987/9960265
1、下载源码包并安装
安装mysql:http://blog.csdn.net/yang_xu_1987/article/details/77648225
安装apache:http://blog.csdn.net/yang_xu_1987/article/details/76412007
安装php:
tar -zxvf php-5.3.22.tar.gz
cd php-5.3.22
./configure --prefix=/usr/local/php --with-libxml-dir=/usr/local/libxml2 --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/etc
make && make install
2、联系apache和php
编辑/usr/local/apache2/conf/httpd.conf
加入AddType application/x-httpd-php .php
重启apache服务
3、为mysql设置密码:
进入mysql
use mysql;
update user set password=password('123') where user='root';
flush privileges;
4、修改iptables规则
编辑/etc/sysconfig/iptables
加入-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
重启iptables service iptables restart
测试同上4,5 (默认目录/usr/local/apache2/htdocs/)
开机启动:将启动命令加入到/etc/rc.d/rc.local