Home >Backend Development >PHP Tutorial >PHP connection to oracle and simple operation_PHP tutorial

PHP connection to oracle and simple operation_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:19:20795browse

To make your PHP support Oracle, follow these steps:

1. To install the php environment, look for appserv or xampp and install it with one click, 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, remove ;extention = php_oci8.dll, and remove the preceding semicolon
4. Restart apache
Two ways to establish a link with 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 method does not work, 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); //Compile sql statement
oci_execute($ora_test,OCI_DEFAULT); //Execute
while($r=oci_fetch_row($ora_test)) //Retrieve the result
{
echo $ora_test[0];
echo "
";
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532692.htmlTechArticleTo 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 system3...
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