Using PHP with Oracle HTTP Server 11g
Oracle HTTP Server is the web server component in Oracle Fusion Middleware. Based on the Apache infrastructure, Oracle HTTP Server allows developers to program their site in a variety of languages and technologies.
PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a general-purpose scripting language often used for generating web sites. The object model of PHP 5 facilitates project development using standard object-oriented methodologies.
With the exponential growth in the use of PHP, mod_php has become the most requested module for Apache. Although PHP interpreter, language and server side module (mod_php) do not ship with the Oracle HTTP Server 11g release, Oracle will assists customers in configuration and inclusion of mod_php into Oracle HTTP Server. Note that Oracle does not support the PHP interpreter and language but it supports Oracle HTTP Server 11g release with mod_php included.
This document provides detailed instructions on how to install and configure PHP to work with Oracle HTTP Server 11g. The following steps have been tested successfully with PHP v5.2.9 and v5.3 and Oracle HTTP Server 11g on Linux platform.
Topics
1.
Pre requisites
1.1
System Requirements
1.2
Software Requirements
2.
Configuring mod_php on Linux
2.1
Pre install steps
2.2
Setting up the environment
2.3.
Configure & install
2.4
Post Install step
Before performing any installation you should read the system requirements and certification documentation to ensure that your environment meets the minimum installation requirements for the products you are installing.
2. Configuring mod_php on Linux
Login as the OS user that installed and configured Oracle HTTP Server and perform following tasks. If you are using PHP 5.2 and want to configuring with Oracle Database (OCI8) support, Oracle recommends you upgrade OCI8 1.3 using the OCI8 extension available at http://pecl.php.net/package/oci8. Do this by installing PHP without OCI8 using the instructions below and then use the 'pecl install oci8' command.
|
~/oraHome1
|
|
~/oraInstance1
|
|
$ gunzip php-5.x.x.tar.gz |
|
$ tar -xvf php-5.x.x.tar |
| ~/php-5.x.x
| |-- build |-- configure |-- php.ini-dist |-- libtool | | +-- sapi |-- ... |
|
$ tar -xvf ociheaders.tar |
|
~/oraHome1
|
2.2 Setting up the environment
Set ORACLE_HOME, ORACLE_INSTANCE, CONF_FILE_PATH and LD_LIBRARY_PATH environment variables.
|
Bash shell:
C shell:
|
With the pre install steps done we are now ready to configure PHP.
|
$./configure --with-apxs2=$ORACLE_HOME/ohs/bin/apxs --prefix=$ORACLE_HOME --with-config-file-path=$CONFIG_FILE_PATH |
|
$./configure --with-apxs2=$ORACLE_HOME/ohs/bin/apxs --prefix=$ORACLE_HOME --with-config-file-path=$CONFIG_FILE_PATH --with-oci8=$ORACLE_HOME --disable-rpath |
Notes: Above config command might appear to be in multiple lines but it is all one line
If you want PHP XML support:
You may also add any other config options desired.
|
$ make $ make install |
Once the make command is executed properly:
- libphp5.so is generated in the ~/php-5.x.x/libs/ directory and copied to $ORACLE_HOME/ohs/modules directory.
- $CONFIG_FILE_PATH/httpd.conf file is updated to load the php5_module.
Now that the required files are generated and copied in the appropriate locations, we have to tell Oracle HTTP Server to service the requests for .php/.phtml/.phps type extensions and restart Oracle HTTP Server.
|
For PHP 5.2: $ cp ~/php-5.x.x/php.ini-dist $CONFIG_FILE_PATH/php.ini For PHP 5.3: $ cp ~/php-5.x.x/php.ini-production $CONFIG_FILE_PATH/php.ini |
Navigate to the $CONFIG_FILE_PATH directory and edit the httpd.conf file to add the following:
|
# And for PHP 5.x use:
|
|
AddType application/x-httpd-php-source .phps |
Finally Oracle HTTP Server should be restarted for the changes to come into effect.
|
$ cd $ORACLE_INSTANCE/bin $ ./opmnctl stopproc ias-component=ohs1 $ ./opmnctl startproc ias-component=ohs1 |
Go to Section 3, "Testing your configuration" to test your configuration.
|
~/oraInstance1
|
