1.编译
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-oci8=/home/oracle/oracle10gr2/product/10.2.0/db_1/ --with-pdo-oci=/home/oracle/oracle10gr2/product/10.2.0/db_1/ --enable-soap --enable-ftp --enable-mbstring=all --enable-mbregex --with-zlib-dir=/usr/ --with-jpeg-dir=/usr/ --with-png-dir=/usr/ --with-freetype-dir=/usr/ --with-gd=/usr/ --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl=/usr/local/openssl/
#make && make install
2.测试oracle连接
#cd /var/www/html
#vim conn.php
$conn = oci_connect('system', 'imjx', 'orcl');
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}else {
echo "连接oracle成功!";
}
?>
刚开始访问时报错:
Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /var/www/html/conn.php on line 3
运行Apache的用户的Oracle权限问题
# vim /usr/local/apache/conf/httpd.conf
User oracle
Group dba
//重启apache测试连接成功
阅读(945) | 评论(0) | 转发(0) |