Lamp
安装apache
[root@localhost ~]# hostname server1
[root@localhost ~]# Last login: Thu Oct 13 19:00:15 2011 from 222.1.1.1
[root@server1 ~]#
[root@server1 ~]#
[root@server1 ~]# hostname www.hotel.com
[root@server1 ~]# yum install httpd*
[root@server1 ~]# rpm -qa |grep http
httpd-devel-
httpd-manual-
httpd-
[root@server1 ~]#
安装mysql
[root@server1 ~]# yum install mysql mysql-server -y
[root@server1 ~]# chkconfig mysqld on
[root@server1 ~]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h www.hotel.com password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
Starting MySQL: [ OK ]
[root@server1 ~]#
[root@server1 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version:
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>\q
[root@server1 ~]# yum install php -y
[root@server1 ~]# rpm -qa |grep php
php-
php-common-
php-cli-
[root@server1 ~]# vim /var/www/html/index.html
test php!
<?php
phpinfo();
?>
[root@server1 ~]# mv /var/www/html/index.html /var/www/html/index.php
[root@server1 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
57-1
安装php与mysql的连接器件,实现连通
[root@server1 ~]# yum install php-mysql.i386 -y
[root@server1 ~]# vim /var/www/html/index.php
test php!
<?php
$link=mysql_connect('127.0.0.1','root');
if($link)
echo "connect success!";
else
echo "connect failed!";
?>
[root@server1 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@server1 ~]# links http://222.1.1.132
http://222.1.1.132/
test php! connect success!
[root@server1 ~]# service mysqld stop
Stopping MySQL: [ OK ]
[root@server1 ~]#
57-2