Home > Article > Backend Development > Use PHP4 to access Oracle815_PHP tutorial
Use PHP4 to access Oracle815 on Windosws 2000 Server
System environment:
1. Operating system: Windows 2000 Server
2. Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition
3. Installation path: D:ORACLE
Installation and configuration of PHP4:
The first step is to unzip the php-4.0.3-Win32.zip compressed package and place it under C:PHP.
The second step is to copy the php.ini-optimized file under C:PHP to the C:WINNT directory and rename it to php.ini.
Modify the php.ini file:
extension_dir = c:php
extension=php_oci8.dll Remove the “;” sign in front of it
extension=php_oracle.dll Remove The ";" sign in front of it
[browscap] browscap = c:phpbrowscapbrowscap.ini Remove the ";" sign in front of the browscap item
The third step is to copy C:PHPphp4ts.dll to C :WINNTsystem32 directory.
The fourth step is to start the IIS management program.
Start-Settings-Control Panel-Administrative Tools-Internet Service Manager Right-click on "Default Web Site" and select Properties,
Then the system pops up the "Default Web Site Properties" window:
Application name enter c:phpphp.exe %s %s Click Configure:
Click Add:
The fifth step, click "ISAPI" on the "Default Web Site Properties" window Filter" tab, click the "Add" button,
Enter "PHP" in the "Filter Name" of the pop-up "Filter Properties" window,
In the "Executable File" Enter "C:phpsapiphp4isapi.dll" and confirm.
The sixth step, REGEDIT, start the registry editor and find:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW3SVCParametersScript Map.
Create a new string: enter name.php
The seventh step is to return to the command line window and enter the "net stop iisadmin" command to terminate the IIS service.
The system will ask you if you want to stop related services, answer yes.
Step 8, enter the "net start w3svc" command to restart the IIS service.
Step nine, copy the two files php_oci8.dll and php_oracle.dll under c:phpextensions to c:php
1. Write the first code test to connect to Oracle. php
$handle = ora_plogon("test@ora815", "gdj") or die; /* Create a handle to connect to oracle*/
$cursor = ora_open($ Handle);/* Open it and give it to a cursor*/
Ora_commitoff ($ handle);
$ Query = "select* from Rate";/* Define a query*/
Ora_parse ($cursor, $query) or die; ; ;HTML>
n"; <br>echo "$querynn"; <br>$numcols = 0; <br>while(ora_fetch($cursor)) { /* Echo the query results stored in $cursor */ <br>$numcols = ora_numcols($cursor); <br>for ($column=0; $column < $numcols; $column++) { <br>$data = trim(ora_getcolumn($cursor, $column )); <br>if($data == "") $data = "NULL"; <br>echo "$datat"; <br>} <br>echo "n"; <br>} <br> $numrows = ora_numrows($cursor); <br>echo "nROWS RETURNED: $numrowsn"; <br>echo "