Centos7下安装apache2.4 php5.6 pdo_oci oci8

一、下载必须的安装源码包
http://httpd.apache.org/download.cgi#apache24
httpd-2.4.23.tar.gz

http://apr.apache.org/download.cgi
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz

https://sourceforge.net/projects/pcre/files/pcre/
pcre-8.39.tar.gz
(安装apache必须安装上面三项)


oracle客户端的安装
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-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/client64
export 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.so
LoadModule rewrite_module modules/mod_rewrite.so
Include conf/extra/httpd-vhosts.conf

<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>


#搜索AddType添加如下
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

修改php.ini
session.save_path = "/data/php56/tmp"
date.timezone = PRC

重启apache
> /data/apache24/bin/apachectl restart
如果无法访问,centos7默认是用firewall作为防火墙,关闭并重新访问。
> systemctl stop firewalld.service
原文地址:https://www.cnblogs.com/jkko123/p/6294562.html