Install lamp--rpm on centos
I. Required software and environment:
System Environment: centos 5.5x64
MySQL version: mysql-5.0.77-3.el5
PHP version: php-5.1.6-23.2.el5_3
Apache version: httpd-2.2.3-31.el5.centos
Ii. Install MySQL
[[email protected] ~]# yum install mysql mysql-server
After installation, MySQL can be automatically started with the system:
[[email protected] ~]# chkconfig --levels 235 mysqld on[[email protected] ~]# /etc/init.d/mysqld start
Set the password for the root account of Mysql Data:
[[Email protected] ~] # Mysqladmin-u Root Password '000000' Note: 123456 is the password you want to set
3. install Apache Components
[[email protected] ~]# yum install httpd
Configure the system to enable Apache with the system:
[[email protected] ~]# chkconfig --levels 235 httpd on
After the configuration is complete, start Apache:
[[email protected] ~]# /etc/init.d/httpd start
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/38/E1/wKioL1O0yNuDXlmdAAQ7x7fVWDU980.jpg "Title =" apa.png "alt =" wkiol1o0ynudxlmdaaq7x7fvwdu980.jpg "/>
NOTE: If other machines cannot access this service and the page is accessible directly on this server, the built-in firewall of centos is generally disabled. Run the following command:
[[email protected] ~]#service iptables stop[[email protected] ~]#setenforce 0
Of course, you can also go to the firewall and open the "80" port corresponding to "www.
Note: In centos, the default Apache root directory is/var/www/html,
Configuration file/etc/httpd/CONF/httpd. conf,
Other configurations are stored in the/etc/httpd/CONF. d/directory.
4. install PHP
Run the following command to install PHP:
[[email protected] ~]# yum install php
You need to restart the apache service:
[[email protected] ~]#service httpd restart
V. Test PHP Information
[[email protected] ~]# vi /var/www/html/test.php
The content is as follows:
<?php phpphpinfo();?>
Save and exit.
At this point, you can access your site address, such as "http: // 192.168.1.2/test. php", to check whether the relevant PHP information can be seen.
The following figure shows that PHP is successfully installed.
6. Associate the PHP module with the MySQL Module
If you need to work, you also need to associate PHP with MySQL. Therefore, you need to install the following sections to work properly.
Install related modules:
[[email protected] ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php
Restart the Apache module to take effect:
[[email protected] ~]# /etc/init.d/httpd restart
Refresh the "test. php" page just created to check whether the MySQL module can be detected,
If you see information about the MySQL module, it means that MySQL is working properly.
This article from "Wipe red dust eventually hurt" blog, please be sure to keep this source http://weihuanjie.blog.51cto.com/3709233/1433848