Centos6.7 编译安装 Apache PHP

前端之家收集整理的这篇文章主要介绍了Centos6.7 编译安装 Apache PHP前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Centos6.7 编译安装 Apache PHP@H_404_5@

##### Apache 编译安装 ####
@H_404_5@

[root@localhost~]#yuminstallgccgcc-c++makewget
[root@localhost~]#yuminstallzlib-developenssl-devel
[root@localhost~]#yuminstall-yperlperl-devel


1)apr
[root@localhostsrc]#wgethttp://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
[root@localhostsrc]#tarzxvfapr-1.5.2.tar.gz
[root@localhostsrc]#cdapr-1.5.2
[root@localhostapr-1.5.2]#./configure--prefix=/usr/local/apache/apr
[root@localhostapr-1.5.2]#make&&makeinstall

2)apr-util
[root@localhostsrc]#wgethttp://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
[root@localhostsrc]#tarzxvfapr-util-1.5.4.tar.gz
[root@localhostsrc]#cdapr-util-1.5.4
[root@localhostapr-util-1.5.4]#./configure--prefix=/usr/local/apache/apr-util--with-apr=/usr/local/apache/apr
[root@localhostapr-util-1.5.4]#make&&makeinstall


3)pcre
[root@localhostsrc]#wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
[root@localhostsrc]#tarzxvfpcre-8.37.tar.gz
[root@localhostsrc]#cdpcre-8.37
[root@localhostpcre-8.37]#./configure
[root@localhostpcre-8.37]#make&&makeinstall

4)apache
[root@localhost~]#cd/usr/local/src/
[root@localhost~]#wgethttp://mirrors.cnnic.cn/apache//httpd/httpd-2.4.17.tar.gz
[root@localhostsrc]#tarzxvfhttpd-2.4.17.tar.gz
[root@localhostsrc]#cdhttpd-2.4.17
[root@localhosthttpd-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

[root@localhosthttpd-2.4.17]#make&&makeinstall

#index.PHP
#AddHandlerPHP5-script.PHP
#AddTypetext/html.PHP
######httpdend###########



[root@localhost~]#ln-s/usr/local/apache/conf/etc/httpd
[root@localhost~]#ln-s/usr/local/apache/bin/*/usr/sbin/

[root@localhost~]#touch/etc/init.d/httpd
[root@localhost~]#chmod755/etc/init.d/httpd

[root@localhost~]#vi/etc/init.d/httpd
#!/bin/bash
#
#httpdStartupscriptfortheApacheHTTPServer
#
#chkconfig:-8515
#description:TheApacheHTTPServerisanefficientandextensible\
#serverimplementingthecurrentHTTPstandards.
#processname:httpd
#config:/etc/httpd/conf/httpd.conf
#config:/etc/sysconfig/httpd
#pidfile:/var/run/httpd/httpd.pid
#
###BEGININITINFO
#Provides:httpd
#required-Start:$local_fs$remote_fs$network$named
#required-Stop:$local_fs$remote_fs$network
#Should-Start:distcache
#Short-Description:startandstopApacheHTTPServer
#Description:TheApacheHTTPServerisanextensibleserver
#implementingthecurrentHTTPstandards.
###ENDINITINFO

#Sourcefunctionlibrary.
./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_LANGdaemon--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$"notreloadingduetoconfigurationSyntaxerror"
failure$"notreloading$httpdduetoconfigurationSyntaxerror"
else
#ForceLSBbehavIoUrfromkillproc
LSB=1killproc-p${pidfile}$httpd-HUP
RETVAL=$?
if[$RETVAL-eq7];then
failure$"httpdshutdown"
fi
fi
echo
}
case"$1"in
start)
start
;;
stop)
stop
;;
status)
status-p${pidfile}$httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
ifstatus-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


[root@localhost~]#chkconfig--addhttpd
[root@localhost~]#chkconfighttpdon

wKiom1eAYFmyBDV8AAB_uIDCqgQ368.png

@H_404_5@

##### PHP 编译安装 ####
@H_404_5@

[root@localhost~]#yuminstalllibxml2-develcurl-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-develnet-snmpnet-snmp-devel


[root@localhostsrc]#wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
[root@localhostsrc]#tarzxvflibiconv-1.14.tar.gz
[root@localhostsrc]#cdlibiconv-1.14
[root@localhostlibiconv-1.14]#./configure--prefix=/usr/local/PHP/libiconv
[root@localhostlibiconv-1.14]#make&&makeinstall


[root@localhostsrc]#wgethttp://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
[root@localhostsrc]#tarzxvflibmcrypt-2.5.8.tar.gz
[root@localhostsrc]#cdlibmcrypt-2.5.8
[root@localhostlibmcrypt-2.5.8]#./configure
[root@localhostlibmcrypt-2.5.8]#make&&makeinstall


[root@localhostlibltdl]#/sbin/ldconfig&&cdlibltdl/
[root@localhostlibltdl]#./configure--enable-ltdl-install
[root@localhostlibltdl]#make&&makeinstall


[root@localhostsrc]#wgethttp://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
[root@localhostsrc]#tarzxvfmhash-0.9.9.9.tar.gz
[root@localhostsrc]#cdmhash-0.9.9.9
[root@localhostmhash-0.9.9.9]#./configure
[root@localhostmhash-0.9.9.9]#make&&makeinstall

[root@localhostsrc]#wgethttp://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
[root@localhostsrc]#tarzxvfmcrypt-2.6.8.tar.gz
[root@localhostsrc]#cdmcrypt-2.6.8
[root@localhostmcrypt-2.6.8]#/sbin/ldconfig&&exportLD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH
[root@localhostmcrypt-2.6.8]#./configure
[root@localhostmcrypt-2.6.8]#make&&makeinstall


[root@localhostsrc]#wgethttp://cn2.PHP.net/distributions/PHP-5.6.15.tar.gz
[root@localhostsrc]#tarzxvfPHP-5.6.15.tar.gz
[root@localhostsrc]#cdPHP-5.6.15

[root@localhostPHP-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

[root@localhostPHP-5.6.15]#make&&makeinstall

[root@localhostPHP-5.6.15]#cpPHP.ini-production/usr/local/PHP/etc/PHP.ini
[root@localhost~]#ln-s/usr/local/PHP/bin/*/usr/sbin/

wKiom1eAYISjw0rcAALxV8U6H00709.png

@H_404_5@ 原文链接:https://www.f2er.com/centos/381685.html

猜你在找的CentOS相关文章