Configure PHP With Oracle HTTP Server (OHS)

Regarding to Oracle Documentation :-

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.

To Configure PHP with Oracle OHS Follow the below steps :-

Step #1:-

export ORACLE_HOME=/Siebel/ohs/Middleware/Oracle_WT1/
export ORACLE_INSTANCE=/Siebel/ohs/Middleware/Oracle_WT1/instances/instance1/
export CONFIG_FILE_PATH=/Siebel/ohs/Middleware/Oracle_WT1/instances/instance1/config/OHS/ohs1/

Step #2:

Download PHP From here.
Upload the file to the server ( should be on the same OHS Server).

gunzip php-5.4.27.tar.gz
tar -xvf php-5.4.27.tar
cd /Siebel/php-5.4.27

Note :-
I Used this version because older version contains bugs
conflicting types for ‘zendparse’

Step #3:-

$./configure –with-apxs2=$ORACLE_HOME/ohs/bin/apxs –prefix=$ORACLE_HOME –with-config-file-path=$CONFIG_FILE_PATH

make
make install

Don’t Run the Above command if nothing not complied successfully.
Once Complied successfully :-

libphp5.so is generated inside php/libs

Step #4:
Inside php folder 

cp php.ini-production $CONFIG_FILE_PATH/php.ini

cd $CONFIG_FILE_PATH
vi httpd.conf
add the below line:-

AddType application/x-httpd-php .php .phtml

Step #5:-
Restart OHS 

./opmnctl stopall
./opmnctl startall

Test PHP :

Install Demo Files HereExtract demo file to $CONFIG_FILE_PATH/htdocs

Using Browser :-

http://:/demo/phpinfo.php

Thank you 
Osama Mustafa
Reference :-
1- Oracle Document Here

Change OHS Port On Linux to Work on 80

Operating system : Oracle Linux 6.4
Oracle WebTier OHS 11.1.1.7

if you want to configure OHS ( WT ) to work on port 80 ( http ) avoiding insert Port.

For Example :

OHS default Port is 7777, if you want to leave it like this any call for the server should be like this :

http://:7777/console  

But if you are using port 80 you have to do the below :

http:///console 

But on Linux if you need to use port 80 you have to be root, to do this follow the below step :

  • As root user :

[root@TST-WT1 bin]# pwd
/u01/fmw/Oracle_WT1/ohs/bin 

[root@TST-WT1 bin]# chown root .apachectl
[root@TST-WT1 bin]# chmod 6750 .apachectl

  • As Oracle User

[oracle@TST-WT1 ~]$ cd /u01/fmw/admin/config/OHS/ohs1/ 

[oracle@SCADNP-WT1 ohs1]$ ls http*
 httpd.conf      

  • Edit the file using any Editor and modify Listen from 7777 to 80
  • Restart OHS using opmnctl command.

——–+———-+———–+——
ohs1                             | OHS                |   15732 | Alive    |  677601509 |   510840 |   0:00:11 | https:9999,https:4443,http:80
Thank you 
Osama Mustafa