banbanbai 发表于 2018-12-12 07:22:41

LAMP架构部署

LAMP组件介绍


[*]LAMP是指Linux、Apache,Mysql以及PHP的简称,目前许多生产环境的都是用的LAMP架构,在网络应用和开发环境方面,LAMP组合是非常棒的,它们的结合提供了强大的功能。
[*]Linux作为底层的操作系统,提供了灵活且安全的应用平台,为其他的组件稳定运行提供了保障;
[*]Apache作为web服务器,提供了功能强大、稳定与支撑能力突出的web平台;
[*]Mysql也是一款优秀的数据库软件;
[*]PHP是一种开发脚本语言,可以嵌入HTML中,适用于web开发;

准备工作
  操作系统:RHEL 6.5
  相关软件包:百度网盘密码:bty7
  本机系统镜像挂载至/mnt/cdrom/ (安装依赖包时使用)

三、php安装


[*]首先安装GD库和GD库关联程序 //用来处理和生成图片//

yum install libjpeg-devel libpng-devel freetype-devel zlib-devel gettext-devel libXpm-devel libxml2-devel fontconfig-devel openssl-devel bzip2-devel -y

[*]解压gd文件至/opt/
tar xzvf gd-2.0.35.tar.gz -C /opt
  3.配置、编译并安装gd


  #进入gd目录下
cd /opt/gd/2.0.35
#配置
./configure --prefix=/usr/local/gd
#编译并安装
make && make install



[*]解压gd文件至/opt/
tar xjvf php-5.4.5.tar.bz2 -C /opt
[*]配置、编译并安装php
  进入php目录下
cd /opt/php-5.4.5/
  #配置
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-gd \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/etc \
--enable-sqlite-utf8 \
--with-zlib-dir \
--with-libxml-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-ttf \
--with-iconv \
--with-openssl \
--with-gettext \
--enable-mbstring \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-static \
--enable-zend-multibyte \
--enable-inline-optimization \
--enable-sockets \
--enable-soap \
--enable-ftp \
--disable-ipv6
  #编译并安装
make && make install


  解决make过程中的错误(此步骤当出现make错误是使用,无错误,请略过)

  vi /usr/local/gd/include/gd_io.h
  void (gd_free) (struct gdIOCtx );
void (*data); //添加//
}
gdIOCtx;
  cp php.ini-production /etc/php.ini#优化调整PHP



[*]配置apache服务,让它支持php
vim /usr/local/apache/conf/httpd.conf

  #找到 AddType application/x-gzip .gz .tgz 在下面添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
  #检查是否存在,查询不到请调到第5步重新安装
LoadModule php5_modulemodules/libphp5.so //必须存在,才可以
  #添加index.php
DirectoryIndex index.php index.html //调整首页文件设置



[*]重新启动httpd服务
service httpd restart
[*]创建php测试页
  #进入网站目录下
cd /usr/local/apache/htdocs/
#创建index.php文件
vim index.php
添加以下内容至index.php文件中
  



测试
  查看php测试页内容,如下图,代表php已经安装完毕,Apache已支持php。
http://i2.运维网.com/images/blog/201805/10/9b17bd1490812182f88e3f8a8f19e2f6.png



页: [1]
查看完整版本: LAMP架构部署