Apache and PHP Installation on Windows
Apache and PHP4
These are the steps necessary to get Apache 1.3 and PHP4 configured on Windows to connect to Oracle.- Download the Apache 1.3 and PHP4 software.
- Install Apache into the "C:\Apache" directory.
- Unzip PHP to the "C:\" drive, rename the top directory to "php".
- Add the following entries to the "C:\Apache\Apache\conf\httpd.conf" file:
LoadModule php4_module c:\php\sapi\php4apache.dll (approx line 193)
AddModule mod_php4.c (approx line 241)
AddType application/x-httpd-php .php (approx line 851) - Copy the "C:\php\php.ini-dist" file to "C:\windows\php.ini"
- Edit the "C:\windows\php.ini", uncommenting the following references:
extension=php_oci8.dll (approx line 570)
extension=php_oracle.dll (approx line 572) - Copy the following files to the "C:\Apache\Apache" directory:
c:\php\sapi\php4apache.dll
c:\php\php4ts.dll
c:\php\php4ts.lib
c:\php\extensions\php_oci8.dll
c:\php\extensions\php_oracle.dll - Restart the Apache service. (Start > Programs > Administrative Tools > Services).
-
Test the OCI extensions by creating a file called "C:\Apache\Apache\htdocs\testOCI.php" with the following contents, adjusting the connection
details as required:
Loading this page in a browser using a URL like "http://localhost/testOCI.php" should produce a list of the tables present in the SCOTT schema.<?php echo "<h1>OCI Test</h1>\n"; $conn=OCILogon("scott", "tiger", "DB10G"); $stmt = OCIParse($conn, "SELECT table_name FROM user_tables ORDER BY table_name"); OCIExecute($stmt, OCI_DEFAULT); while (OCIFetch($stmt)) { $table_name = OCIResult($stmt, "TABLE_NAME"); echo "$table_name<br />\n"; } OCIFreeStatement($stmt); OCILogoff($conn); ?>
Apache2 and PHP5
These are the steps necessary to get Apache2 and PHP5 configured on Windows to connect to Oracle.- Download the Apache2 and PHP5 software.
- Install Apache into the "C:\Apache" directory.
- Unzip PHP into the "C:\php" directory.
- Add the following entries to the "C:\Apache\Apache\conf\httpd.conf" file:
LoadModule php5_module "C:/php/php5apache2.dll" (approx line 173)
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
- Copy the "C:\php\php.ini-recommended" file to "C:\windows\php.ini"
- Edit the "C:\windows\php.ini", uncommenting the following reference:
Edit the extension_dir parameter as follows:extension=php_oci8.dll (approx line 648)
extension_dir = "C:/php/ext" (approx line 519) - Restart the Apache service (Start > Programs > Administrative Tools > Services).
-
Test the OCI extensions by creating a file called "C:\Apache\Apache2\htdocs\testOCI.php" with the following contents, adjusting the connection
details as required:
Loading this page in a browser using a URL like "http://localhost/testOCI.php" should produce a list of the tables present in the SCOTT schema.<?php echo "<h1>OCI Test</h1>\n"; $conn=OCILogon("scott", "tiger", "DB10G"); $stmt = OCIParse($conn, "SELECT table_name FROM user_tables ORDER BY table_name"); OCIExecute($stmt, OCI_DEFAULT); while (OCIFetch($stmt)) { $table_name = OCIResult($stmt, "TABLE_NAME"); echo "$table_name<br />\n"; } OCIFreeStatement($stmt); OCILogoff($conn); ?>
Back to the Top.
