System version: Red Hat 6.5 Enterprise Apache version: httpd-2.2.17 mysql version: mysql-5.5.38 php Version: php-5.3.28
The lamp platform is composed of four components: Linux system, Apache Web server, MySQL database server and its PHP (or Perl, Python) Web page, the advantage is low cost, customizable, easy to develop, easy to use, safe and stable, This is also widely used by various enterprises reasons
The first thing to note is that when building the lamp platform, the components are installed in the order of Linux, Apache, MySQL, PHP, where Apache and MySQL installation is not in strict order, and the PHP environment is generally placed in the final installation, To be responsible for communicating Web server and database system coordination work.
Apache installation Please refer to "Apache Service source installation and basic configuration "
MySQL installation Please refer to "MySQL database source installation "
First, build PHP running Environment
1. Preparation: In order to avoid a degree of conflict, it is recommended to first uninstall the RPM-installed PHP-related package
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7C/6A/wKioL1bQFZWgurXcAAAcUyRpOf4840.jpg "title=" Uninstall the relevant package. jpg "alt=" wkiol1bqfzwgurxcaaacuyrpof4840.jpg "/>
2. SDK Zlib-devel and libxml2-devel required to install PHP
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7C/6C/wKiom1bQFkTzAftxAAAXMBxxeFo676.jpg "title=" Install the developer kit. jpg "alt=" wkiom1bqfktzaftxaaaxmbxxefo676.jpg "/>
3. Install the Extensions ToolPak libmcrypt,mhash,mcrypt, if not available from http://sourceforge.net download
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7C/6C/wKiom1bQGAXS5LU2AABIOnJPCH4201.jpg "title=" Extensions toolpak. jpg "alt=" wkiom1bqgaxs5lu2aabionjpch4201.jpg "/>
Install Libmcrypt and connect the library file to the default path of the Linux search library file
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7C/6C/wKiom1bQGK2CUMuoAAAzDh0qW38578.jpg "title=" Install libmcrypt.jpg "alt=" Wkiom1bqgk2cumuoaaazdh0qw38578.jpg "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7C/6C/wKiom1bQGYuT5OsFAAAd8L_8hRQ566.jpg "title=" Libmcrypt soft connect. jpg "alt=" wkiom1bqgyut5osfaaad8l_8hrq566.jpg "/>
Install Mhash and create a soft connection path
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7C/6C/wKiom1bQGpOz_c-LAAAwHvCpTsI730.jpg "title=" Install mhash.jpg "alt=" Wkiom1bqgpoz_c-laaawhvcptsi730.jpg "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7C/6C/wKioL1bQHCywKNzZAAAYl3qExDQ474.jpg "title=" Mhash soft connect. jpg "alt=" wkiol1bqhcywknzzaaayl3qexdq474.jpg "/>
Install MCrypt, note that there will be an error when configuring MCrypt, the workaround is as follows
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7C/76/wKioL1bQ9raDRSz4AABasnoQwQA930.jpg "title=" Install mcrypt.jpg "alt=" Wkiol1bq9radrsz4aabasnoqwqa930.jpg "/>
4. Compiling and installing PHP
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7C/76/wKioL1bQ-v-zYIrSAABqlw46KY8851.jpg "title=" PHP installation. jpg "alt=" wkiol1bq-v-zyirsaabqlw46ky8851.jpg "/>
--prefix: Specifying the installation directory
--WITH-APXS2: Specifies the file location of the APXS module support program provided by the APACEH
--with-config-file-path: Specify the location where the PHP configuration file is stored
--with-mysql: Specify the MySQL database server installation location
--with-mcrypt: Extension tools support for loading data encryption
--enable-mbstring: Enable multi-byte string support in order to support Chinese code
5. Post-Installation adjustments
PHP.ini Configuration Adjustment
First copy the PHP.ini sample file provided in the source directory to the PHP installation directory and rename it to PHP.ini. The source directory provides two sample files, one is the Php.ini-development board sample for learning, the other is the Php.ini-production production version of the sample for the actual operation, here we first use the Development Board sample
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7C/71/wKioL1bQTtCCsooWAAAewMwKtFw808.jpg "title=" Php.jpg "alt=" Wkiol1bqttccsoowaaaewmwktfw808.jpg "/>
httpd.conf Configuration Adjustment
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7C/76/wKioL1bQ_C-SFtW3AAAXVsean7g698.jpg "title=" Httpd.conf.jpg "alt=" Wkiol1bq_c-sftw3aaaxvsean7g698.jpg "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7C/76/wKioL1bQ_iSgoZU2AABRm90m2lU203.jpg "title=" httpd.conf configuration. jpg "alt=" wkiol1bq_isgozu2aabrm90m2lu203.jpg "/>
So we set up the lamp environment, and then we'll verify if we can work together.
Second, verify lamp work together
Notice the Firewall
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7C/77/wKioL1bRASThzSZOAAA9AyA5V_I894.jpg "title=" firewall. jpg "alt=" wkiol1brasthzszoaaa9aya5v_i894.jpg "/>
1. Test whether PHP Web page can access
Write the ". PHP" End of the test page under HTTPd's Web site root directory test1.php
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7C/78/wKiom1bQ_4vSfkgSAAAX5Kw2G3Y645.jpg "title=" Write test1.jpg "alt=" Wkiom1bq_4vsfkgsaaax5kw2g3y645.jpg "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7C/78/wKiom1bRAP-ix6v1AAAK5bUZzrk628.jpg "title=" Test1 test page. jpg "alt=" wkiom1brap-ix6v1aaak5buzzrk628.jpg "/>
Client Access
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7C/77/wKioL1bRAkPA5KLEAACPZ9HMQgQ529.jpg "title=" Visit the Test1 test page. jpg "alt=" wkiol1brakpa5kleaacpz9hmqgq529.jpg "/>
2. Test whether PHP Web page can access MySQL database
Then write a test page to validate the connection to the database test2.php
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7C/77/wKioL1bRA46C6-xrAAAYQzyiD20011.jpg "title=" New test2 test page. jpg "alt=" wkiol1bra46c6-xraaayqzyid20011.jpg "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7C/78/wKiom1bRCQjhT79wAAApC5JPlgQ313.jpg "title=" Test2 test page. jpg "alt=" wkiom1brcqjht79waaapc5jplgq313.jpg "/>
Client Access
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7C/78/wKiom1bRCUyycvAEAAB5ofsZKgQ899.jpg "title=" Visit the Test2 test page. jpg "alt=" wkiom1brcuyycvaeaab5ofszkgq899.jpg "/>
Deployment of the Linux server lamp platform