首页 > 代码库 > PHP数据库配置

PHP数据库配置

安装和连接
1.安装instantclient_12_1 2.在php.ini中打开extension=php_oci8扩展。;extension=php_oci8变成extension=php_oci8 3.将php/ext目录下的php_oci8.dll文件拷贝到system32目录下。
4.设置环境变量(如网页提示错误,删除NLS_LANG环境变量尝试)
5. 重启服务
6.php连接代码
$dbconn = oci_connect(‘jlz2014‘,‘jlz2014‘,"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= 192.168.xx.xx)(PORT=1521))(CONNECT_DATA=http://www.mamicode.com/(SID=ora100)))");
if ($dbconn) {
echo ‘success‘;
}else {
echo ‘error‘;
}

数据库配置文件

添加主键

CREATE SEQUENCE UICBL_SEQUENCE

INCREMENT BY 1

START WITH 1

NOMAXVALUE

NOCYCLE

CACHE 10;

CREATE TRIGGER UICBL_TRIGGER BEFORE

insert ON USERID_CONF_BLOCK_LOG FOR EACH ROW

begin

         select UICBL_SEQUENCE.nextval into:New.ID from dual;

end;

 

PHP数据库配置