Apache 2.4.18
Install Apr,apr-util first, and Pcre
# tar XVF apr-1.5.2.tar.gz
# CD apr-1.5.2
#./configure--prefix=/usr/local/apr && make && make install
2, Installation Apr-util
# tar XVF apr-util-1.5.4.tar.bz2
# CD apr-util-1.5.4
#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr && make && make install
3, Installation Pcre
# tar XVF pcre-8.37.tar.bz2
# CD pcre-8.37
#./configure--prefix=/usr/local/pcre && make && make install
4. Installing httpd
./configure--prefix=/usr/local/apache--enable-so--enable-ssl--enable-cgi--with-rewrite--with-zlib--with-pcre=/ Usr/local/pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--enable-mpms-shared=all--with-mpm= Prefork--enable-proxy--enable-proxy-http--ENABLE-PROXY-AJP--enable-proxy-balancer--enable-lbmethod-heartbeat-- Enable-heartbeat--enable-slotmem-shm--enable-slotmem-plain--enable-watchdog
It is important to specify a few paths, apr,apr-util,pcre
The other one is,--with-mpm=prefork and--enable-so.
5. Add PATH environment variable
# cat/etc/profile.d/apache.sh
# Export path= $PATH:/usr/local/apache/bin
# . /etc/profile.d/apache.sh
6. Edit Configuration httpd.conf configuration file
# vim/usr/local/apache/conf/httpd.conf
#取消注释, otherwise the startup will report the following error
LoadModule Slotmem_shm_module modules/mod_slotmem_shm.so
Error
Tailf/usr/local/apache/logs/error_log
[Thu Feb 04 10:36:40.825258 2016] [Proxy_balancer:emerg] [PID 61695:tid 139808143390464] Ah01177:failed to lookup provider ' SHM ' for ' slotmem ': Is Mod_slotmem_shm loaded??
[Thu Feb 04 10:36:40.825457 2016] [: Emerg] [PID 61695:tid 139808143390464] Ah00020:configuration Failed, exiting
7, write startup script, easy to boot from startup
#!/bin/bash## httpd startup script for the apache http server## chkconfig: - 85 15# description: apache is a world wide web server. it is used to serve # HTML files and CGI.# processname: Httpd# config: /etc/httpd/conf/httpd.conf# config: /etc/sysconfig/httpd# pidfile: /var/run/httpd.pid# source function library. /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/httpd ]; then . /etc/sysconfig/httpdfi# start httpd in the c locale by default. httpd_lang=${httpd_lang-"C"}# this will prevent initlog from swallowing up a pass-phrase prompt if# mod_ssl needs a pass-phrase from the user. Initlog_args= "" # set httpd=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server# with the thread-based "Worker" MPM; BE WARNED That some modules may not# work correctly with a thread-based MPM; notably PHP will refuse to start.# Path to the Apachectl script, server binary, and short-form for messages.apachectl=/usr /local/apache/bin/apachectlhttpd=${httpd-/usr/local/apache/bin/httpd}prog=httpdpidfile=${pidfile-/var/run/ Httpd.pid}lockfile=${lockfile-/var/lock/subsys/httpd}retval=0start () { 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 10 $httpdRETVAL =$?echo[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}}reload () { echo -n $ "Reloading $ prog: " if ! lang= $HTTPD _lang $httpd $OPTIONS -t >&/dev/null; then RETVAL=$? echo $ "not reloading due to configuration syntax Error " failure $ "not reloading $httpd due to configuration syntax error " else killproc -p ${pidfile} $httpd -HUP RETVAL=$? fi echo}# See how we were called.case " $ " in start" start; stop) stop;; status) status -p ${pidfile} $ Httpdretval=$?;; restart) Stopstart;; condrestart) if [ -f ${pidfile} ] ; thenstopstartfi;; reload) reload;; graceful|help|configtest|fullstatus) $apachectl [email protected]RETVAL=$?;; *) echo $ "usage: $prog {start|stop|restart|condrestart|reload|statUs|fullstatus|graceful|help|configtest} "exit 1esacexit $RETVAL
It is important to specify the path to these files is OK, be sure if you install the path:
apachectl=/usr/local/apache/bin/apachectlhttpd=${httpd-/usr/local/apache/bin/httpd}prog=httpdpidfile=${ Pidfile-/var/run/httpd.pid}
8.httpd.pid file
Because the PID configuration of httpd in the self-startup script is under/var/run/httpd.pid, you also need to modify the httpd.conf configuration file
Vim/usr/local/apache/conf/httpd.conf
Pidfile "/var/run/httpd.pid"
After the addition, create a file in/var/run/httpd.pid, set up read and write permissions.
Then reboot the PC, because occasionally there will be no restart, unable to shut down the httpd process with service httpd stop.
A reboot will be OK.
HTTPD's over here.
Remember to check if there is a line in the httpd.conf:
LoadModule Php7_module modules/libphp7.so
=====================================================================
Installation of PHP 7:
Install the OpenSSL component, or the SSL too old fault will be reported
Yum-y Openssl-devel
2. Install other required components
Yum-y install libxml2 libxml2-devel OpenSSL openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt -devel
3. Compiling
./configure--PREFIX=/USR/LOCAL/PHP7--with-config-file-path=/usr/local/php7/etc--with-config-file-scan-dir=/usr /LOCAL/PHP7/ETC/PHP.D--with-apxs2=/usr/local/apache/bin/apxs--with-mcrypt=/usr/include--enable-mysqlnd-- With-mysqli--with-pdo-mysql--enable-fpm--with-gd--with-iconv--with-zlib--enable-xml--enable-shmop-- Enable-sysvsem--enable-inline-optimization--enable-mbregex--enable-exif--enable-mbstring--enable-ftp-- Enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap-- Without-pear--with-gettext--enable-session--with-curl--with-jpeg-dir--with-freetype-dir--enable-opcache-- Disable-fileinfo
It is more important to have these several:
(1): Must add, remember to check/usr/local/apache/bin/have apxs this file
--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS \
(2): These are based on the specific needs of the programmer plus
--enable-exif--enable-mbstring--with-gd \
Then there is
Made && make install
4. Configuration files
into the PHP source decompression package:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/C8/wKioL1csa7yRypAAAABLq3hsUCY926.png "title=" Qq20160506175613.png "alt=" Wkiol1csa7yrypaaaablq3hsucy926.png "/>
CP Php.ini-production/usr/local/php7/etc/php.ini #在源文件目录下cp sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm #在源文件目录下cp/ usr/local/php7/etc/php-fpm.conf.default/usr/local/php7/etc/php-fpm.confcp/usr/local/php7/etc/php-fpm.d/ Www.conf.default/usr/local/php7/etc/php-fpm.d/www.conf
5. Add System Variables:
Echo-e ' \nexport path=/usr/local/php7/bin:/usr/local/php7/sbin: $PATH \ n ' >>/etc/profile && source/etc/ Profile
Set the PHP log directory and the PHP-FPM process files (php-fpm.sock) directory:
Mkdir-p/var/log/php-fpm/&& mkdir-p/var/run/php-fpm && cd/var/run/&& chown-r nginx:nginx ph p-fpm
Mkdir-p/var/lib/php/session
Chown-r nginx:nginx/var/lib/php
6. Set Boot up
chmod +x/etc/init.d/php-fpm
Chkconfig--add PHP-FPM
Chkconfig PHP-FPM on
7. Start the service
Service PHP-FPM Start
NETSTAT-TLUNP See if the ports 80 and 9000 are open.
=================================
Integrate PHP7 and Apache
Add two lines at the end of the/usr/local/apache/conf/httpd.conf:
AddType application/x-httpd-php. php
Phpinidir "/usr/local/php7/"
After this, add the index.php index file:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/C8/wKioL1csbQGwSxybAAAnDsDVxqM800.png "title=" 11111111111111111.png "alt=" Wkiol1csbqgwsxybaaandsdvxqm800.png "/>
Restarting Apache will be OK.
This article is from the "clear" blog, make sure to keep this source http://duanyexuanmu.blog.51cto.com/1010786/1770839
Apache 2.4.18+PHP7 Installation Process