一、下载必须的安装源码包http://httpd.apache.org/download.cgi#apache24httpd-2.4.23.tar.gzhttp://apr.apache.org/download.cgiapr-1.5.2.tar.gzapr-util-1.5.4.tar.gzhttps://sourceforge.net/projects/pcre/files/pcre/pcre-8.39.tar.gz(安装apache必须安装上面三项)oracle客户端的安装http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.htmloracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpmoracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm二、把上述源码包上传到服务器上。三、安装软件> tar -zxvf apr-1.5.2.tar.gz> cd apr-1.5.2> ./configure --prefix=/data/apr> make && make install> tar -zxvf apr-util-1.5.4.tar.gz> cd apr-util-1.5.4> ./configure --prefix=/data/apr-util \> --with-apr=/data/apr> make && make install> tar -zxvf pcre-8.39.tar.gz> cd pcre-8.39> ./configure --prefix=/data/pcre \> --with-apr=/data/apr> make && make install安装oracle客户端> rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm> rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm添加软链接> ln -s /usr/include/oracle/11.2/client64 /usr/include/oracle/11.2/client> ln -s /usr/lib/oracle/11.2/client64 /usr/lib/oracle/11.2/client修改/etc/profile文件> vi /etc/profile在文件最下方添加export ORACLE_HOME=/usr/lib/oracle/11.2/client64export LD_LIBRARY_PATH=$ORACLE_HOME/lib> source /etc/profile安装apache> yum -y install gd zlib libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libxslt-devel> tar -zxvf httpd-2.4.23.tar.gz> cd httpd-2.4.23>./configure --prefix=/data/apache24 \--with-pcre=/data/pcre \--with-apr=/data/apr \--with-apr-util=/data/apr-util \--enable-so \--enable-rewrite> make && make install安装php> tar -zxvf php-5.6.28.tar.gz> cd php-5.6.28> ./configure --prefix=/data/php56 \--with-apxs2=/data/apache24/bin/apxs \--with-curl \--with-freetype-dir \--with-gd \--with-gettext \--with-iconv-dir \--with-kerberos \--with-libdir=lib \--with-libxml-dir \--with-mysqli=mysqlnd \--with-openssl \--with-pcre-regex \--with-pdo-mysql=mysqlnd \--with-pdo-sqlite \--with-pear \--with-png-dir \--with-xmlrpc \--with-xsl \--with-zlib \--with-iconv=/usr/local/libiconv \--with-pdo-oci=instantclient,/usr,11.2 \--with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib \--enable-mysqlnd \--enable-fpm \--enable-bcmath \--enable-libxml \--enable-inline-optimization \--enable-gd-native-ttf \--enable-mbregex \--enable-mbstring \--enable-opcache \--enable-pcntl \--enable-shmop \--enable-soap \--enable-sockets \--enable-sysvsem \--enable-xml \--enable-zip \--enable-pthreads \--enable-maintainer-zts \--enable-fileinfo \如果提示如下问题configure: error: Please reinstall the iconv library.请安装iconv库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/libiconv> make && make install如果出现如下问题,说明你系统版本较高。./stdio.h:1010:1: 错误:‘gets’未声明(不在函数内)> cd srclib/> sed -i -e '/gets is a security/d' ./stdio.in.h> cd ../> make重新安装> make && make install修改httpd.conf文件LoadModule php5_module modules/libphp5.soLoadModule rewrite_module modules/mod_rewrite.soInclude conf/extra/httpd-vhosts.confDirectoryIndex index.html index.htm index.php #搜索AddType添加如下AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps修改php.inisession.save_path = "/data/php56/tmp"date.timezone = PRC重启apache> /data/apache24/bin/apachectl restart如果无法访问,centos7默认是用firewall作为防火墙,关闭并重新访问。> systemctl stop firewalld.service