How to install PHP5, GD and OCI8 for Oracle Application Server on linux

Steps for linux 32 bits :

0.  Install rpm’s :
httpd-devel –  Development tools for the Apache HTTP server
libjpeg –  A library for manipulating JPEG image format files
libjpeg-devel –
libpng –   A library of functions for manipulating PNG image format files
libpng-devel –  Development tools for programs to manipulate PNG image format files
libXpm – libXpm runtime library
libXpm – libXpm development package
freetype – A free and portable font rendering engine
freetype-devel – FreeType development libraries and header files
php-ldap – A module for PHP applications that use LDAP.
php53-ldap – A module for PHP applications that use LDAP

Run:

ln -s /usr/lib/libjpeg.so /usr/lib/
ln -s /usr/lib/libpng.so /usr/lib/
ln -s /usr/lib/libXpm.so /usr/lib/
ln -s /usr/lib/libldap.so /usr/lib/

1. Download PHP5 from http://www.php.net/downloads.php and extract in $HOME/php5

gunzip php-5.x.x.tar.gz
tar -xvf php-5.x.x.tar

 

2. Download the Oracle Instant Client basic and sdk 10g from http://www.oracle.com/technetwork/database/features/instant-client and extract in $HOME/instantclient

 

3. Set LD_LIBRARY_PATH to instantclient path

export LD_LIBRARY_PATH=$HOME/instantclient/instantclient_10_2

 

4. Export CFLAGS

export CFLAGS=-DLINUX

 

5. Copy libdms2.so to instantclient path

cp  $ORACLE_HOME/lib/libdms2.so $HOME/instantclient/instantclient_10_2

 

6. Create symbolic link to library

cd $HOME/instantclient/instantclient_10_2
ln -s libclntsh.so.10.1 libclntsh.so

 

7. Create directory for GD images

mkdir -p $ORACLE_HOME/Apache/Apache/php/img

 

8. Run configure

cd $HOME/php5/php-5.3.6

./configure --prefix=$ORACLE_HOME/Apache/Apache/php --with-apxs=$ORACLE_HOME/Apache/Apache/bin/apxs --with-config-file-path=$ORACLE_HOME/Apache/Apache/conf --with-oci8=instantclient,/home/oracle/instantclient/instantclient_10_2 --disable-rpath --with-gd --with-gd2 --with-ldap --enable-sigchild --with-pic --enable-mbstring --disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --with-freetype --with-freetype-dir=$ORACLE_HOME/Apache/Apache/php/img --with-jpeg-dir=$ORACLE_HOME/Apache/Apache/php/img --with-png-dir=$ORACLE_HOME/Apache/Apache/php/img--with-xpm-dir=$ORACLE_HOME/Apache/Apache/php/img >install_log.txt

 

9. If ‘configure’ succeeded without any errors issue the ‘make’ command

make

 

10. If ‘make’ succeeded without any errors issue the ‘make install’ command

make install

 

11. Add path ‘PHPRC’ on opmn.xml to php.ini

After : <ias-component id="HTTP_Server"> <process-type id="HTTP_Server" module-id="OHS">

Add :

<environment>
 <variable id="PHPRC" value="$ORACLE_HOME/Apache/Apache/conf/"/>
 </environment>

 

12. Reload opmn

opmnctl reload

 

13. Restart HTTP Server

opmnctl stopproc ias-component=HTTP_Server

opmnctl startproc ias-component=HTTP_Server

 

When starting if you have thsi error:

“Cannot load /etc/httpd/modules/libphp5.so into server: libclntsh.so.10.1: cannot open shared object file: No such file or directory”

Run (32 or 64 bits):

cp -rp $ORACLE_HOME/lib/libnnz10.so /usr/lib/.
or
cp -rp $ORACLE_HOME/lib/libnnz10.so /usr/lib64/.

 

Steps for linux 64 bits :

1. Follow the same 32 bits steps 1 to 10

2. Copy the php files from 32 bits machine to 64 bits machine

copy  $ORACLE_HOME/Apache/Apache/php and  $ORACLE_HOME/Apache/Apache/libexec/libphp5.so

3.With ROOT user on linux 64 make symbolic links

cd /usr/lib
ln -s libldap-2.3.so.0 libldap.so.2
ln -s liblber-2.3.so.0 liblber.so.2

ln -s /usr/lib64/libjpeg.so /usr/lib/
ln -s /usr/lib64/libpng.so /usr/lib/
ln -s /usr/lib64/libXpm.so /usr/lib/
ln -s /usr/lib64/libldap.so /usr/lib/

4. Follow steps 11 to 13

 

Good Luck !

Leave a Reply