发表于 2018-11-19 13:37:08

Centos6.7 编译安装 Apache PHP

Centos6.7 编译安装 Apache PHP
  ##### Apache 编译安装 ####

# yum install gcc gcc-c++ make wget
# yum install zlib-devel openssl-devel
# yum install -y perl perl-devel

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

3) pcre
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
# tar zxvf pcre-8.37.tar.gz
# cd pcre-8.37
# ./configure
# make && make install
4) apache
# cd /usr/local/src/
# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.17.tar.gz
# tar zxvf httpd-2.4.17.tar.gz
# cd 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
# make && make install
#index.php
#AddHandler php5-script .php
#AddType text/html .php
###### httpd end ###########

# ln -s /usr/local/apache/conf /etc/httpd
# ln -s /usr/local/apache/bin/* /usr/sbin/
# touch /etc/init.d/httpd
# chmod 755 /etc/init.d/httpd
# 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 $@
    RETVAL=$?
    ;;
*)
    echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
    RETVAL=2
esac
exit $RETVAL

# chkconfig --add httpd
# chkconfig httpd on
  ##### PHP编译安装 ####

# yum install libxml2-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel net-snmp net-snmp-devel

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

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

# /sbin/ldconfig && cd libltdl/
# ./configure --enable-ltdl-install
# make && make install

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

# wget http://cn2.php.net/distributions/php-5.6.15.tar.gz
# tar zxvf php-5.6.15.tar.gz
# cd 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
# make && make install
# cp php.ini-production /usr/local/php/etc/php.ini
# ln -s /usr/local/php/bin/* /usr/sbin/



页: [1]
查看完整版本: Centos6.7 编译安装 Apache PHP