LAMP is a mature website application model. It is generally used for the management of websites such as malls, blogs, and businesses. It has a set of collaborative software components that can provide environments for wep website service development and so on. It is also composed of all open-source free software and has good stability. Therefore, it is used by many users.
1) LAMP Composition
LAMP linux + apache + mysql + php
Linux: the linux operating system is open-source, runs stably, and has high security. apache is highly compatible with components: It is widely used in wed server construction, with stable functions and complete services, ability to provide various customer service requirements mysql: the popular small database is a relational database management system with high flexibility. Although its functions are not perfect, it can still meet the needs of the mall, blog and other website data storage, modification, maintenance requirements php: Dynamic Programming Language Program for web development and maintenance
2) LAMP construction
A) yum Installation
We use the rpm package that comes with the system for installation. To avoid the package dependency, we first configure a yum client. Edit vim/etc/yum. repos. d/rhel-debuginfo.repo file [rhel-Server] name = Red Hat Enterprise Linux Serverbaseurl = file: // mnt/cdrom/Serverenabled = 1 gpgcheck = 1 gpgkey = file: /// mnt/cdrom/RPM-GPG-KEY-redhat-release because we only need to install some software, we only need to compile server Service B) installation of the software package # yum install httpd mysql-server mysql php-gd php-mysql because yum will solve the package dependency on its own, we only need to list some software, will install. start the apache service and set it to start automatically # service httpd start // start httpd # chkconfig httpd on // Set to start from B. start mysql service # service mysqld start // start mysql # netstat-tulnp | grep mysqld // view mysql service port # chkconfig mysqld on // set it to start from startup # mysqladmin-u root- p password '000000' // to ensure database security, set User Account c. test the connection between apache and php. We know that in the lamp environment, apache and php are linked through modules, while php and mysql are linked through php-mysql first. d/php. in the conf configuration file, we can determine that apache and php are connected through the module 650) this. width = 650; "title =" 2013-08-26_100318.png "src =" http://www.bkjia.com/uplo Ads/allimg/131228/112 F31Y9-0.png "/> How do we test whether the connection between apache and php is normal? It's easy to write a small webpage and test a. First, go to cd/var/www/html/and edit vim index. php // With the suffix php. <? Phpphpinfo () // phpinfo is a function in php. You can call to view php?> 650) this. width = 650; "title =" 2013-08-26_100534.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F3JY-1.png "width =" 602 "height =" 252 "/> If the above interface appears in the test, the connection between apache and mysql is normal
B. Test the connection between mysql and php. First, go to cd/var/www/html/and edit vim index. php. <? Php $ link = mysql_connect ('192. 0.0.1 ', 'root', '123'); if ($ link) echo "OK"; elseecho "not OK";?> Http: // 192.168.1.190/index. if the php test page shows OK, the connection is normal and the scheduling database is successful. 3) after the LAMP application environment is set up, let's use some applications, the application ECShop_V2.7.2_UTF8_Release0505.zip of a mall website contains a php webpage, including tables, which must be stored in the database. LAMP provides 5 access methods and physical directories for webpage access, virtual directory, based on port, ip, and host header) Here we use the directory method. You only need to put the page in/var/www/html. First, upload the compressed file to the Linux operating system and decompress it. The unzip ECShop_V2.7.2_UTF8_Release0505.zip directory contains an upload directory, we only need to move it to/var/www/html/to rename mv upload/var/www/html/ecshop as ecshop) chmod-R a + w images // set some directories to writeable chmod-R a + w data/chmod-R a + w temp/chmod-R a + w themes/ http: // 192.168.1.190/ecshop/The following page appears
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100835.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F3NE-2.png "/>
Click Next
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100852.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F34N7-3.png "/>
Click Next. The following page is displayed.
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100905.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F3O47-4.png "/>
At this time, we can see that a shop data packet is added to the mysql database.
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100918.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F33564-5.png "width =" 709 "height =" 369 "/>
4) through phpmyadmin realize database interface management to upload the required components to linux libmcrypt-2.5.7-5.el5.i386.rpmphp-mcrypt-5.1.6-5.el5.i386.rpmphpMyAdmin-2.11.10.1-all-languages decompress unzip phpMyAdmin-2.11.10.1-all-languages.zip // decompress package mv phpMyAdmin-2.11.10.1-all-languages/var/www/html/phpmyadmin // move to the directory and change name to phpmyadminyum locainstall libmcrypt-2.5.7-5.el5.i386.rpm php-mcrypt-5.1.6-5.el5.i386.rpm -- nogpgcheck // install related software
Because we use the physical directory to access the webpage, we can access the webpage directly, but the following interface is displayed:
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100930.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F3DR-6.png "width =" 694 "height =" 228 "/>
To solve this problem, copy the configuration file and edit cp-p config. sample. inc. php config. inc. php vim config. inc. php.
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100941.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F34233-7.png "width =" 689 "height =" 138 "/>
Next, restart the apache service to access http: // 192.168.1.190/phpmyadmin/. The page appears.
650) this. width = 650; "style =" float: none "title =" 2013-08-26_100953.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F324B-8.png "width =" 689 "height =" 378 "/>
650) this. width = 650; "style =" float: none "title =" 2013-08-26_101004.png "src =" http://www.bkjia.com/uploads/allimg/131228/112F34F3-9.png "width =" 690 "height =" 443 "/>
At this time, we can manage and create databases through the interface.
This article is from the "those once" blog, please be sure to keep this source http://slayr.blog.51cto.com/7613374/1282616