博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
九、LAMP的安装与配置
阅读量:7120 次
发布时间:2019-06-28

本文共 5626 字,大约阅读时间需要 18 分钟。

常见PHP开源软件:

  论坛:phpwind、discuz 、phpbb

  博客系统:wordpress

  门户站点:drupal、xooms

  数据库:phpMyAdmin、Workbench、MySQL Front、Navicat for MySQL、Toad

  CMS(Content Management System)内容管理系统:Drupal、joomla

PHP与httpd的结合方式:

  Module作为模块,需要时加载:

  prefork: 一个请求用一个进程处理,稳定性好、大并发场景下消耗资源较多;事先创建进程,按需维 持适当的进程,模块块设计,核心比较小,各种功能都模块添加(包括php),支持运行配置,支持单独编译模块,支持多种方式的虚拟主机配置。

  worker: 一个进程多个线程,一个线程响应一个请求

  event: 一个线程响应多个请求,事件驱动,主要目的在于实现单线程响应多个请求

  Cgi(Common gateway interface):通用网关接口,为HTTP服务器与其他机器上的程序服务通信的一种交流工具。(CGI程序必须运行在网络服务器,每次HTTP服务遇到动态程序时都需要成新启动解析器)

  Fastcgi,可伸缩的,高速的在HTTP服务器和动态脚本语言间通信的接口,优点是把动态语言和HTTP服务器相分离。其主要行为是将CGI解释器进程保持在内存中并因此获得较高的性能。CGI解释器的反复加载是CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器调度,则可以提供良好的性能、伸缩性、Fail- Over特性等等。

  LAMP配置顺序:httpd --> MySQL --> php --> XCache(缓存器/优化器)

  rpm格式配置lamp

# yum -y install httpd php php-mysql mysql-server mysql php-mcrypt

9.2、编译安装LAMP

软件版本:

apacge:httpd-2.4.25.tar.gz

  依赖包:apr-1.5.2.tar.gz  apr-util-1.5.4.tar.gz

mysql:mysql-5.5.55-linux2.6-x86_64.tar.gz

php:  php-5.6.30-src.zip

相关软件下载:
#wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.gz#wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz#wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz#wget http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz#wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

1、安装apache

[root@mylinux app]# tar xf apr-1.5.2.tar.gz[root@mylinux app]# cd apr-1.5.2[root@mylinux apr-1.5.2]## ./configure --prefix=/usr/local/apr[root@mylinux apr-1.5.2]## make && make install[root@mylinux app]# tar xf apr-util-1.5.4.tar.gz [root@mylinux app]# cd apr-util-1.5.4[root@mylinux apr-util-1.5.4]./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/[root@mylinux apr-util-1.5.4]make && make install[root@mylinux home]#yum install pcre-devel -y[root@mylinux app]# tar xf httpd-2.4.25.tar.gz [root@mylinux app]# cd httpd-2.4.25[root@mylinux httpd-2.4.25]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event[root@mylinux httpd-2.4.25]#make && make install[root@mylinux httpd24]# vim /etc/httpd24/httpd.conf     #修改配置文件   PidFile  "/var/run/httpd.pid"                        #添加该行   ServerName 127.0.0.1:80                              #修改服务名称    #提供服务脚本[root@mylinux httpd24]# cp /home/app/httpd-2.4.25/build/rpm/httpd.init /etc/rc.d/init.d/httpd[root@mylinux init.d]# vim /etc/rc.d/init.d/httpd       #修改相关参数 CONFFILE=/etc/httpd24/httpd.conf apachectl=/usr/local/apache/bin/apachectl httpd=${HTTPD-/usr/local/apache/bin/httpd} pidfile=${PIDFILE-/var/run/${prog}.pid} lockfile=${LOCKFILE-/var/lock/subsys/${prog}} RETVAL=0 prog=httpd [root@mylinux init.d]# chmod +x /etc/rc.d/init.d/httpd   #为此脚本赋予执行权限[root@mylinux init.d]# chkconfig --add httpd             #加入服务列表[root@mylinux init.d]# service httpd start               #启动测试Starting httpd: [  OK  ]

2、通用二进制格式安装MySQL

[root@mylinux app]# tar xf mysql-5.5.55-linux2.6-x86_64.tar.gz [root@mylinux app]# ln -sv /home/app/mysql-5.5.55-linux2.6-x86_64 /usr/local/mysql`/usr/local/mysql' -> `/home/app/mysql-5.5.55-linux2.6-x86_64'[root@mylinux app]# cd mysql[root@mylinux mysql]# chown -R root:mysql .[root@mylinux mysql]# scripts/mysql_install_db --user=mysql          #初始化[root@mylinux mysql]# cp support-files/my-large.cnf /etc/my.cnf      #提供配置文件[root@mylinux mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld #服务脚本[root@mylinux mysql]# service mysqld start                           #启动测试Starting MySQL.. SUCCESS! [root@mylinux profile.d]# vim /etc/mysql.sh                          #添加环境变量[root@mylinux profile.d]# source mysql.sh [root@mylinux profile.d]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.55-log MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quitBye[root@mylinux profile.d]#

3、安装PHP

# yum -y groupinstall "Desktop Platform Development"    #解决依赖关系# yum -y install bzip2-devel libmcrypt-devel[root@mylinux app]# tar xf php-5.6.30.tar.gz[root@mylinux app]# cd php-5.6.30[root@mylinux php-5.6.30]#  ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts[root@mylinux php-5.6.30]# make[root@mylinux php-5.6.30]# make test[root@mylinux php-5.6.30]# make install[root@mylinux php-5.6.30]# cp php.ini-production  /etc/php.ini   #提供配置文件

4、修改apache相关配置

 # vim /etc/httpd/httpd.conf   AddType application/x-httpd-php  .php           #添加两行   AddType application/x-httpd-php-source  .phps   ...   
    DirectoryIndex  index.php index.html           #修改该行   

5、测试

[root@mylinux php-5.6.30]# service httpd restartStopping httpd: [  OK  ]Starting httpd: [  OK  ][root@mylinux htdocs]# vim /usr/local/apache/htdocs/123.php 
[root@mylinux htdocs]# vim /usr/local/apache/htdocs/index..php

本文转自 梦想成大牛 51CTO博客,原文链接:http://blog.51cto.com/yinsuifeng/1932921,如需转载请自行联系原作者

你可能感兴趣的文章
javascript中的链表结构—双向链表
查看>>
POJ 2586 Y2K Accounting Bug(枚举大水题)
查看>>
java高级工程师(二)
查看>>
NavMesh动态碰撞
查看>>
asp.net core中的razor页面
查看>>
JS获取子节点、父节点和兄弟节点的方法实例总结
查看>>
Design Your Own Protocol In Five Minutes
查看>>
[Debug] Diagnose a Slow Page Using Developer Tools
查看>>
7 个最好的.Net开源CMS系统
查看>>
[转]xna 3.1 to xna 4.0
查看>>
[转]Android SurfaceView 绘图覆盖刷新及脏矩形刷新方法
查看>>
NYOJ-305 表达式求值
查看>>
hdu 4427 Math Magic
查看>>
linux内核--内存管理(二)
查看>>
原生andriod浏览器回退后dom(click)事件全体失效问题探究
查看>>
IPHONE 开发 1 -- 体系介绍
查看>>
邮箱验证
查看>>
python小知识
查看>>
用位运算求一个数的绝对值
查看>>
settimeout vs setinternal
查看>>