Detailed LAMP platform to build

LAMP architecture is one of the mature enterprise web application model that can provide dynamic Web site services and application development environment.
LAMP is an acronym, including:
1, Linux operating system
2, Apache web server
3, MySQL database server
4, PHP / Perl / Python web programming language
of these four components are the same leader, reflected in:
1 inexpensively
2, can be customized
3, easy to develop
4, easy to use
5, security and stability
while building LAMP platform, the installation order of the components were: Linux, Apache, MySQL, PHP . Apache and MySQL installation in which there is no strict order; PHP is generally placed at the end, responsible for communication web servers and database systems.
https://blog.51cto.com/14227204/2424170 the Apache service installation
https://blog.51cto.com/14227204/2425596 the MySQL service is installed (for reference, can choose)
https://pan.baidu.com/ s / 1bvWgs6 - P_ja2QNf6E7IrQ install the required source package
extraction code: u3me
preparation:
usual first check whether the system is currently installed PHP rpm package rpm -qa | grep php, if you have to uninstall
first of all we need to install a few dependencies :

[root@mysql /]# mount /dev/sr0 /media/                    # 挂载系统光盘
mount: /dev/sr0 is write-protected, mounting read-only
[root@mysql /]# cd /media/Packages/
[root@mysql Packages]# rpm -ivh  zlib-devel-1.2.7-17.el7.x86_64.rpm 
xz-devel-5.2.2-1.el7.x86_64.rpm 
libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm 

Installing an expansion tool library, data encryption tools libmcrypt, mhash, mcrypt etc.
installation libmcrypt:

[root@mysql media]# tar zxf libmcrypt-2.5.8.tar.gz -C /usr/src/
[root@mysql media]# cd /usr/src/libmcrypt-2.5.8/
[root@mysql libmcrypt-2.5.8]# ./configure && make && make install     # 一气呵成
[root@mysql libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.* /usr/lib/      # 创建链接文件方便系统识别

Installation mhash:

[root@mysql media]# tar zxf mhash-0.9.9.9.tar.gz -C /usr/src/
[root@mysql media]# cd /usr/src/mhash-0.9.9.9/
[root@mysql mhash-0.9.9.9]# ./configure && make && make install
[root@mysql mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.* /usr/lib/

Install mcrypt:

[root@mysql media]# tar zxf mcrypt-2.6.8.tar.gz -C /usr/src/
[root@mysql media]# export LD_LIBRARY_PATH=/usr/local/lib
:$LD_LIBRARY_PATH                # 此条命令解决 configure 配置错误
[root@mysql media]# ./configure && make && make install

It took years to compile and install PHP:

[root@mysql media]# tar zxf php-5.5.38.tar.gz -C /usr/src/
[root@mysql media]# cd /usr/src/php-5.5.38/
[root@mysql php-5.5.38]# ./configure --prefix=/usr/local/php5 \
> --with-mcrypt \
> --with-apxs2=/usr/local/httpd/bin/apxs \
> --with-mysql=/usr/local/mysql \
> --with-mysqli=/usr/local/mysql/bin/mysql_config \
> --with-config-file-path=/usr/local/php5 \
> --enable-mbstring
[root@mysql php-5.5.38]# make && make install     # 编译并安装
上述配置命令含义:
--prefix:指定将 PHP 程序安装到那个目录下
--with-mcrypt:加载数据加密等扩展工具支持
--with-apxs2:设置 Apache 提供的 apxs 模块支持程序的文件位置
--with-mysql:设置 MySQL 数据库服务程序的安装位置
--with-mysqli:添加 mysqli 扩展支持
--with-config-file-path:设置 PHP 的配置文件 php.ini 将要存放的位置
--enable-mbstring:启用多字节多字符串功能,以便支持中文等代码

Set LAMP environment:
After installing the PHP package, the server does not automatically create the php.ini configuration file, but provides two sample configuration files in the source package inside:

/usr/src/php-5.5.28/php.ini-development        //  开发版样例文件,用于学习、测试
/usr/src/php-5.5.28/php.ini-production            // 生产版样例文件,用于实际运营

Select a copy it into the configuration directory PHP

[root@mysql php-5.5.38]# cp php.ini-development /usr/local/php5/php.ini
[root@mysql /]# vim /usr/local/php5/php.ini         # 编辑配置文件
……                   // 省略部分内容
default_charset = "utf-8"                //设置默认的字符集为 utf-8
file_uploads = On                          // 允许通过 PHP 网页上传文件
upload_max_filesize = 2M            //允许上传的文件大小
max_file_uploads = 20                 //每个 HTTP 最多允许请求上传的文件数
post_max_size = 8M                    // 每次通过表单 post 提交的数据量限制
short_open_tag = On                   // 允许识别 PHP 短语法标记,即<?......?>
extension=php_mysqli.dll             // 添加 MySQL 支持

ZendGuardLoader optimization module, he can improve the efficiency of PHP programs, optimize page loading speed
this can choose not to install does not affect PHP
add ZendGuardLoader optimization module:

 [root@mysql media]# tar zxf zend-loader-php5.5-linux-x86_64_update1.tar.gz -C /usr/src/                   
 [root@mysql media]# cd /usr/src/zend-loader-php5.5-linux-x86_64/
[root@mysql zend-loader-php5.5-linux-x86_64]# cp ZendGuardLoader.so /usr/local/php5/lib/php/           # 复制到 PHP 配置目录下
[root@mysql /]# vim /usr/local/php5/php.ini 
……     // 省略部分内容
zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enable=1

httpd.conf configuration adjustments:

[root@mysql /]# vim /usr/local/httpd/conf/httpd.conf
……                         // 省略部分内容
LoadModule php5_module        modules/libphp5.so       # 确认配置文件中有此行
<IfModule dir_module>
    DirectoryIndex index.html   index.php            # 添加语句 index.php
</IfModule>
 AddType application/x-httpd-php .php             # 添加此语句
 注意:上述配置均不在同一处地方,需要查询

At this point, PHP basic installation is complete, the next test
write a test page a .php file, the file stored in the root directory of the next page

[root@mysql /]# vim /usr/local/httpd/htdocs/test1.php
<?php
phpinfo();
?>     

Detailed LAMP platform to build
Testing PHP page can access the MySQL database:

[root@mysql /]# vim /usr/local/httpd/htdocs/test2.php 
<?php
$link=mysqli_connect('localhost','root','123');        # 用于连接数据库的用户和密码
if($link) echo "koko!!";            # 此处是访问成功的显示文本
mysqli_close($link);
?>

Detailed LAMP platform to build

The last step is the most essential step in the site, is the site of the background to manage the MySQL database through a web page, using PHPMyadmin management suite source package from the official site https://www.phpmyadmin.net/ be Download:
after extracting the source package directory, move to the next site directory, and renamed phpadmin:

[root@mysql media]# tar zxf phpMyAdmin-4.7.2-all-languages.tar.gz -C /usr/local/httpd/htdocs/
[root@mysql media]# cd /usr/local/httpd/htdocs/
[root@mysql htdocs]# mv phpMyAdmin-4.7.2-all-languages phpmyadmin

Copy the directory to the site later, you also need to create a profile before normal use, you can use the template config.sample.inc.php make changes to the file name to config.inc.php can be, there is a line "blowfish_secret" the paper configuration items, have set up a default key phrase (this key is used to page cookie authentication, without our memory), can modify according to their own needs, I am here only the file name change it, can be used normally:

[root@mysql htdocs]# cd phpmyadmin/
[root@mysql phpmyadmin]# mv config.sample.inc.php config.inc.php 

Detailed LAMP platform to build

Guess you like

Origin blog.51cto.com/14227204/2426964