Access Oracle815 with PHP4 on ipvsws 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
Install and configure PHP4:
Step 1: Open the php-4.0.3-win32.zip package and place it under C: PHP.
Step 2: copy the PHP. ini-optimized file under C: php to the C: WINNT directory and change it to php. ini.
Modify the php. ini file:
Extension_dir = c: php
Extension = php_oci8.dll remove the previous ";"
Extension = php_oracle.dll remove the previous ";"
[Browscap] browscap = c: phpbrowscapbrowscap. ini remove the ";" sign before the browscap item
Step 3: Copy C: PHPphp4ts. dll to the C: WINNTsystem32 directory.
Step 4: Start the IIS management program.
Choose "start"> "Settings"> "Control Panel"> "Administrative Tools"> "Internet Service Manager", right-click "Default Web site", and select Properties,
The "Default Web site properties" window is displayed:
Enter c: phpphp.exe % s in the Application name and click Configure:
Click Add:
Step 5: click "ISAPI filter" in the "Default Web site properties" window and click "add,
In the pop-up "Filter Properties" window, enter "PHP" in "Filter Name ",
Enter "C: phpsapiphp4isapi. dll" in the executable file, and then click OK.
Step 6, REGEDIT, start Registry Editor to find:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW3SVCParametersScript Map.
Create a new string: Enter the name. php
Step 7: 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 the related services. A: Yes.
Step 8: Enter the "net start w3svc" command to restart the IIS service.
In step 9, copy the php_oci8.dll and php_oracle.dll files under c: phpextensions to c: php.
1. Write the first Oracle connection code test. php.
<? Php
$ Handle = ora_plogon ("test @ ora815", "gdj") or die;/* Create a handle connecting to oracle */
$ Cursor = ora_open ($ handle);/* open it and assign it to a cursor */
Ora_commitoff ($ handle );
$ Query = "SELECT * FROM rate";/* define a query */
Ora_parse ($ cursor, $ query) or die;/* assign this query to the cursor */
Ora_exec ($ cursor);/* run the cursor, that is, run the query */
Echo "<HTML> <PRE> n ";
Echo "$ querynn ";
$ Numcols = 0;
While (ora_fetch ($ cursor) {/* Save the query result echo in $ cursor */
$ Numcols = ora_numcols ($ cursor );
For ($ column = 0; $ column <$ numcols; $ column ++ ){
$ Data = trim (ora_getcolumn ($ cursor, $ column ));
If ($ data = "") $ data = "NULL ";
Echo "$ datat ";
}
Echo "n ";
}
$ Numrows = ora_numrows ($ cursor );
Echo "nROWS RETURNED: $ numrowsn ";
Echo "</PRE> </HTML> n ";
Ora_close ($ cursor );
?>