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

Why does PHP code link oracle error occur?

藏色散人
Release: 2023-02-27 06:06:01
Original
2133 people have browsed it

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');
Copy after login

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>";
}
Copy after login

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)))");
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template