Monday, July 13. 2009

FreeBSD7下安装php5-oci8

FreeBSD

过程还算顺利,参考了一篇文章,详见内文。

主要步骤:
1、安装jdk以及javavmwrapper等一堆依赖的包,没什么特别的,就是啰嗦一些
2、安装instantclient-basic以及instantclient-sdk,见内文
3、编辑安装php5-oci8,用ports安装,没什么特别的

This post is intented to help those trying to install PHP with Oracle support on FreeBSD. I’ll just note that this setup was tested and implemented in FreeBSD 6.2-STABLE. I also assume that your ports location is /usr/ports.

1. Install necessary FreeBSD ports

  1. Oracle instant client: /usr/ports/databases/linux-oracle-instantclient-basic/
    You’ll need to download a Linux version of instant client from http://www.oracle.com/technology/tech/oci/instantclient/index.html and put it in /usr/ports/distfiles/oracle. The exact version will depend on the freshness of your port revision. At the moment of writing it is “instantclient-basic-linux32-10.2.0.2-20060331.zip”.
  2. Oracle instant client SDK: /usr/ports/databases/linux-oracle-instantclient-sdk/
    Another file for download from Oracle (location and destination are the same like in step 1). File name at the moment of writing is “instantclient-sdk-linux32-10.2.0.2-20060331.zip”.
  3. Oracle8-client: /usr/ports/databases/oracle8-client/
    Unofficial port of Linux version Oracle client. After doing “make install” go to /usr/local/oracle8-client/freebsd. Execute redefine-syms.sh, then - make, make patch and make install. If make fails with redefinition of gethostbyname_r function error, open oci8stub.c for editing and delete the declaration of this function in this file. Now it should compile correctly. After doing make install, symlink /lib/liboci8stub.a to /usr/local/oracle8-client/lib.

2. Environment setup

  1. (optional) Set linker options. If you’re using bash, type: export LDFLAGS=”-lcompat -lpthread”
  2. Set ORACLE_HOME location. If you’re using bash, type: export ORACLE_HOME=”/usr/local/oracle8-client”

3. Install PHP5

  1. Install PHP5 base from /usr/ports/lang/php5 (make && make install)
  2. Install PHP5 extensions from /opt/ports/lang/php5-extensions (make - for typical ncurses menu - simple but very convenient) NOTE: you won’t find OCI8 or other database extensions here - they are located in the other location
  3. Install PHP5-OCI8 extension from /usr/ports/databases/php5-oci8 (you’ll find all other available PHP5 database extensions in /usr/ports/databases)

4. Tips

  1. It is mandatory that ORACLE_HOME environment variable is set to /usr/local/oracle8-client during startup of Apache (or any other web server of your choice).
  2. If you want to use tnsnames.ora then put it into /usr/local/oracle8-client/network/admin. Adjust necessary settings in sqlnet.ora as well.
  3. In some cases setting TNS_ADMIN environment variable to /usr/local/oracle8-client/network/admin is necessary.
Trackbacks
No Trackbacks
Comments
Display comments as (Linear | Threaded)
No comments
Add Comment


有人发送垃圾信息不遗余力,本人不胜其烦,所以只好委屈您填写一下如下代码
CAPTCHA

 
 

Categories

All categories

Calendar

« 2010 年 September »
Mon Tue Wed Thu Fri Sat Sun
    1 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Archives

Quicksearch

Syndicate This Blog

XML RSS 1.0 feed
XML RSS 2.0 feed

Blog Administration

Open login screen

访问统计

Locations of visitors to this page
The articles in this sites are copyrighted, except those marked as reshipped
MII Record: 05029638