Centos6.7 编译安装 Apache PHP

Centos6.7 编译安装 Apache PHP


##### Apache 编译安装 ####
[[email protected] ~]# yum install gcc gcc-c++ make wget
[[email protected] ~]# yum install zlib-devel openssl-devel
[[email protected] ~]# yum install -y perl perl-devel

1) apr
[[email protected] src]# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
[[email protected] src]# tar zxvf apr-1.5.2.tar.gz
[[email protected] src]# cd apr-1.5.2
[[email protected] apr-1.5.2]# ./configure --prefix=/usr/local/apache/apr
[[email protected] apr-1.5.2]# make && make install

2) apr-util
[[email protected] src]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
[[email protected] src]# tar zxvf apr-util-1.5.4.tar.gz
[[email protected] src]# cd apr-util-1.5.4
[[email protected] apr-util-1.5.4]# ./configure --prefix=/usr/local/apache/apr-util --with-apr=/usr/local/apache/apr
[[email protected] apr-util-1.5.4]# make && make install

3) pcre
[[email protected] src]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
[[email protected] src]# tar zxvf pcre-8.37.tar.gz
[[email protected] src]# cd pcre-8.37
[[email protected] pcre-8.37]# ./configure
[[email protected] pcre-8.37]# make && make install

4) apache
[[email protected] ~]# cd /usr/local/src/
[[email protected] ~]# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.17.tar.gz
[[email protected] src]# tar zxvf httpd-2.4.17.tar.gz
[[email protected] src]# cd httpd-2.4.17
[[email protected] httpd-2.4.17]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apache/apr/bin/apr-1-config --with-apr-util=/usr/local/apache/apr-util/bin/apu-1-config --enable-module=so --enable-mods-shared=all --enable-deflate --enable-expires --enable-headers --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-mime-magic --enable-authn-dbm --enable-vhost-alias --enable-so --enable-rewrite --enable-ssl --with-mpm=prefork

[[email protected] httpd-2.4.17]# make && make install

#index.php
#AddHandler php5-script .php
#AddType text/html .php
###### httpd end ###########

[[email protected] ~]# ln -s /usr/local/apache/conf /etc/httpd
[[email protected] ~]# ln -s /usr/local/apache/bin/* /usr/sbin/

[[email protected] ~]# touch /etc/init.d/httpd
[[email protected] ~]# chmod 755 /etc/init.d/httpd

[[email protected] ~]# vi /etc/init.d/httpd
#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible  #           server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
#  implementing the current HTTP standards.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi
HTTPD_LANG=${HTTPD_LANG-"C"}
INITLOG_ARGS=""
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}
stop() {
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=6
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        # Force LSB behaviour from killproc
        LSB=1 killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
        if [ $RETVAL -eq 7 ]; then
            failure $"httpd shutdown"
        fi
    fi
    echo
}
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
        status -p ${pidfile} $httpd
    RETVAL=$?
    ;;
  restart)
    stop
    start
    ;;
  condrestart|try-restart)
    if status -p ${pidfile} $httpd >&/dev/null; then
        stop
        start
    fi
    ;;
  force-reload|reload)
        reload
    ;;
  graceful|help|configtest|fullstatus)
    $apachectl [email protected]
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
    RETVAL=2
esac
exit $RETVAL

[[email protected] ~]# chkconfig --add httpd
[[email protected] ~]# chkconfig httpd on

##### PHP 编译安装 ####
[[email protected] ~]# yum install libxml2-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel net-snmp net-snmp-devel

[[email protected] src]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
[[email protected] src]# tar zxvf libiconv-1.14.tar.gz
[[email protected] src]# cd libiconv-1.14
[[email protected] libiconv-1.14]# ./configure --prefix=/usr/local/php/libiconv
[[email protected] libiconv-1.14]# make && make install

[[email protected] src]# wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
[[email protected] src]# tar zxvf libmcrypt-2.5.8.tar.gz
[[email protected] src]# cd libmcrypt-2.5.8
[[email protected] libmcrypt-2.5.8]# ./configure
[[email protected] libmcrypt-2.5.8]# make && make install

[[email protected] libltdl]# /sbin/ldconfig && cd libltdl/
[[email protected] libltdl]# ./configure --enable-ltdl-install
[[email protected] libltdl]# make && make install

[[email protected] src]# wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
[[email protected] src]# tar zxvf mhash-0.9.9.9.tar.gz
[[email protected] src]# cd mhash-0.9.9.9
[[email protected] mhash-0.9.9.9]# ./configure
[[email protected] mhash-0.9.9.9]# make && make install

[[email protected] src]# wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
[[email protected] src]# tar zxvf mcrypt-2.6.8.tar.gz
[[email protected] src]# cd mcrypt-2.6.8
[[email protected] mcrypt-2.6.8]# /sbin/ldconfig && export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
[[email protected] mcrypt-2.6.8]# ./configure
[[email protected] mcrypt-2.6.8]# make && make install

[[email protected] src]# wget http://cn2.php.net/distributions/php-5.6.15.tar.gz
[[email protected] src]# tar zxvf php-5.6.15.tar.gz
[[email protected] src]# cd php-5.6.15

[[email protected] php-5.6.15]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc  --with-iconv=/usr/local/php/libiconv --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-pear --with-freetype-dir --with-zlib --with-libxml-dir --with-iconv-dir --with-xmlrpc --with-mhash --with-mcrypt --with-curl --with-openssl --with-snmp --with-gettext --enable-pdo --enable-mbstring --enable-ctype --enable-simplexml --enable-ftp --enable-sockets --enable-gd-native-ttf --enable-sysvsem --enable-exif --enable-sysvshm --enable-xml --enable-dom --enable-simplexml --enable-shmop --enable-zip --enable-mbregex --enable-bcmath --enable-inline-optimization --enable-soap

[[email protected] php-5.6.15]# make && make install

[[email protected] php-5.6.15]# cp php.ini-production /usr/local/php/etc/php.ini
[[email protected] ~]# ln -s /usr/local/php/bin/* /usr/sbin/

时间: 2024-11-03 21:08:25

Centos6.7 编译安装 Apache PHP的相关文章

centos6.5编译安装apache

1 检查系统是否有安装的apache 2.删除已经存在的apahce 3.下载apache2.2.27源码包 wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.27.tar.gz4 .安装编译环境 yum install gcc gcc-c++ -y 5. 创建apache的安装路径(默认/usr/local/apache2) mkdir -p /application/apache2.2.27 6 解压 tar -zxvf httpd

【Linux】编译安装Apache服务

实验环境 使用Linux的系统为CentOS6.5 x64 安装Apache所需要的源码包有 httpd-2.4.16.tar.gz apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz 下载地址:http://pan.baidu.com/s/1skcEHFB 实验配置 首先安装如下编译工具以及软件包 [[email protected] ~]# yum -y install gcc gcc-c++ make pcre-devel 编译安装apr和apr-util这两个包

Linux编译安装Apache的详细过程

LAMP 是 Linux Apache MySQL PHP 的简写,其实就是把 Apache,MySQL 以及 PHP安装在 Linux 系统上,组成一个环境来运行 PHP 的脚本语言.Apache 是最常用的 WEB 服务软件,所以安装Apache必不可少,其中编译安装Apache又尤为重要,接下来我一步步来编译安装Apache. 具体步骤: 1,准备工作:首先保证有Linux系统的PC或者服务器,我这里是CentOS6.8的64位的系统(最小化安装):然后得保证你系统能正常使用wget,因为

Centos6.6编译安装apache2.4.9

本系列教程感谢linux大神马哥提供指导: Centos6.7编译安装httpd 2.4.9 + mysql-5.5.33 + php-5.4.26 (LAMP) 一.编译安装apache2.4.9 httpd-2.4: 新特性: (1) MPM支持运行DSO机制:以模块形式按需加载: (2) 支持eventMPM: (3) 支持异步读写: (4) 支持每模块及每个目录分别使用各自的日志级别: (5) 每请求配置:<If> (6) 增强版的表达式分析器: (7) 支持毫秒级的keepalive

centos6.5编译安装lamp开发环境

一.系统以及软件的准备 系统及编译安装包的下载地址:http://pan.baidu.com/s/1jIjqinc   密码:ghc2 说明:由于centos6.5是分卷压缩的,且压缩为三个压缩包,所以请下载三个压缩包,并放于同一文件夹中,解压CentOS-6.5-x86_64-bin-DVD.zip即可. lamp安装包文件夹中有19个安装包,均为必要的环境安装包或依赖包;下载完成之后将lamp安装包压缩为.zip格式压缩包. 本次环境安装已以上系统和安装包为实验安装,为确保安装正确,请严格按

配置网络YUM源和第三方YUM源及编译安装Apache

配置网络YUM源和第三方YUM源及编译安装Apache 系统软硬件环境平台: VMware Workstation Pro 12.5.5 build-5234757 CentOS Linux release 7.3.1611 内核版本:3.10.0-514.el7.x86_64 测试时间:2017年6月13日 实验1:实现网络YUM源 1.准备相关系统光盘,搭建网络服务ftp或http [执行命令]#ls /mnt [执行命令]#mount | grep "/dev/sr0" [执行命

CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src/Apache-2.2.25 tar -xzvf ./httpd-2.2.25.tar.gz cd ./httpd-2.2.25 #生成configure ./configure --prefix=/usr/local/apache --with-included-apr --enable-so -

在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录

php与apache协作有三种模式:CGI.modules.FastCGI. 在CGI模式下,用户请求php文件时,apache会启动响应进程,调用php处理器处理请求,然后将结果返回给客户端.用户响应及处理由前端apache服务器完成: 在modules模式下,php解析器作为apache的一个模块,php处理器与web服务器一起运行处理用户请求.用户响应由apache处理,请求处理由apache与php处理器协同完成: 在fastcgi模式下,apache调用proxcy模块,发挥代理作用,

CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17

所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar.gz /usr/local/src/PHP-5.2.17/mcrypt-2.6.8.tar.gz /usr/local/src/PHP-5.2.17/libiconv-1.14.tar.gz /usr/local/src/PHP-5.2.17/php-5.2.17.tar.gz 在编译PHP之前,先