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

 

相关文章

1、到apache官网上下载apache的安装文件 http://httpd.apache.org/download.cgi 点击链接Files for Mic...
1.确保apache已开启rewrite。 2.在.htaccess文件中添加如下: RewriteEngine On RewriteCond %{HTTP_RE...
在httpd.conf中修改ErrorLog和CustomLog的配置 ErrorLog &quot;|E:/apache2.2/bin/rotatelogs.exe ...
1、打开apache的配置文件httpd.conf,打开如下项 LoadModule proxy_module modules/mod_proxy.so LoadM...
一、下载必须的安装源码包 http://httpd.apache.org/download.cgi#apache24 httpd-2.4.23.tar.gz http:...
1.在apache配置文件httpd.conf中找到如下行: #LoadModule rewrite_module modules/mod_rewrite.so 去掉...