部署方法分一下几种步骤
1.下载安装oracle客户端
2.下载安装apache
3.下载安装php
4.配置apache
5.测试
下载安装Oracle 客户端
从oracle官网下载oracle的rpm客户端,具体下载页面如下
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
根据你的oracle db版本及操作系统下载相应版本的oracle客户端,本示例中采用64位centos操作系统oracle 10.2.1的oracle db,为安装简便话建议采用下载rpm软件包进行安装,具体只需要下载以下两个软件包,
oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm
oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm
安装软件需注册,免费注册登录后可免费下载oracle 客户端。下载完成后上传到服务器进行安装,通过简单的rpm命令即可完成安装
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm
rpm -ivh oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm
下载apache,安装apache
wget http://apache.etoak.com/httpd/httpd-2.2.11.tar.bz2
tar xf httpd-2.2.11.tar.bz2
cd httpd-2.2.11
./configure --prefix=/usr/local/apache --enable-module=so
make
make install
建立启动脚本
cp build/rpm/httpd.init /etc/rc.d/init.d/httpd
修改启动脚本/etc/rc.d/init.d/httpd
找到以下几行
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
CONFFILE=/etc/httpd/conf/httpd.conf
分别对应修改为:
apachectl=/usr/local/apache/bin/apachectl
httpd=${/usr/local/apache/bin/httpd}
CONFFILE=/usr/local/apache/conf/httpd.conf
设定apache自启动
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig httpd on
下载安装php
yum -y install zlib zlib-devel gd gd-devel libjpeg libjpeg-devel libpng libpng-devel
wget http://cn.php.net/get/php-5.2.9.tar.bz2/from/cn2.php.net/mirror
tar xf php-5.2.9.tar.bz2
cd php-5.2.9
./configure \
--with-oci8=instantclient,/usr/lib/oracle/10.2.0.4/client64/lib \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-zlib \
--enable-mbstring \
--with-gd \
--with-jpeg-dir
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
配置apahce使它支持php,编辑/usr/local/apache/conf/httpd.conf文件,在AddType application/x-gzip .gz .tgz后添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
编辑apache的启动脚本是它启动时加载到oracle的客户端文件,编辑/usr/local/apache/bin/envvars在文件的开头添加如下内容
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export PATH
export ORACLE_BASE=/usr/lib/oracle
export ORACLE_HOME=$ORACLE_BASE/10.2.0.4/client64
export ORACLE_SID=oracle_sid
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
以上就完成了LAOP平台的搭建,可以启动apache进行测试
/etc/init.d/httpd start
在网站的根目录中建立phpinfo文件进行测试
phpinfo();
?>
打开phpinfo页面可以看到有一个oci8的选项,说明php的oracle扩展已经安装成功。
也可以通过下面的这个命令检查输出的内容是否包含oci选项确认php的oracle扩展安装是否成功
/usr/local/php/bin/php -m
0 评论:
发表评论