Home  >  Article  >  Backend Development  >  Why does PHP code link oracle error occur?

Why does PHP code link oracle error occur?

藏色散人
藏色散人Original
2019-10-17 10:03:052050browse

Why does PHP code link oracle error occur?

Why does the PHP code link oracle error occur?

The error when linking PHP code to Oracle is because PHP does not support Oracle. You need to make your PHP support Oracle. Follow the following steps:

1. Install the PHP environment and look for appserv Or xampp, one-click installation, very convenient

2. Copy php_oci8.dll in the ext directory of php to the system32 directory

3. Modify the configuration in the php.ini file and remove ;extension = php_oci8.dll, remove the preceding semicolon

4. Restart apache

Two ways to establish a link with the oracle database

1.$conn = oci_connect('username','password',"(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=192.168.1.100)(PORT = 1521))(CONNECT_DATA =(SID=test)))");
2.$conn = oci_connect('username','password','192.168.1.100/test');

Sometimes the first way No, use the second method. The parameters are user name, password, oracle service address, where test is the service name.

$sql = "select * from table_exmaple"
$ora_test = oci_parse($conn,$sql); //编译sql语句
oci_execute($ora_test,OCI_DEFAULT); //执行
while($r=oci_fetch_row($ora_test)) //取回结果
{
echo $ora_test[0];
echo "<BR>";
}

Try changing it to this:

$dbconn = oci_connect(&#39;用户名&#39;,&#39;密码&#39;,"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.136.1.10)(PORT=1521))(CONNECT_DATA=(SID=pmsbp)))");

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Why does PHP code link oracle error occur?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn