Well, some one recently asked in our forums to how to get PHP working with Oracle iPlanet Web Server and Oracle Database. So, here is a quick write up on how I got this done:

First, let us download Oracle Instant Client package - Basic and Oracle Instant Client package - SDK Client for your respective platform from here . I am assuming here that I have downloaded and unzipped this file in my home directory.

  • [sriramn@sriramn:~:$] unzip instantclient-basic-linux32-11.2.0.1.zip

    [sriramn@sriramn:~:$] unzip instantclient-sdk-linux32-11.2.0.1.zip

When I uncompressed this client library, I noticed that Oracle Client library is missing a symbolic link. Not sure, if this is a deliberate or a simple overlook from our Oracle Instant Client team. In any case, we will need create a missing symbolic link so that PHP is able to build with this Instant Client library.



  • [sriramn@sriramn:~:$] cd instantclient_11_2

    [sriramn@sriramn:~/instantclient_11_2:$] ln -sf libclntsh.so.11.1 libclntsh.soNow, let us download PHP from php.net and try to compile with PHP/FastCGI support as shown below:

Now that we have got Oracle Instant Client downloaded and set up nicely let us go ahead and download PHP from here. Here, I am trying to download and use PHP 5.2. However, if you wanted to use PHP 5.3, you could do the same as well :

  • [sriramn@sriramn:~:$] tar jxvfp php-5.2.13.tar.bz2

    [sriramn@sriramn:php-5.2.13:$] cd php-5.2.13

    [sriramn@sriramn:php-5.2.13:$] ./configure --prefix=~/php-52 --enable-fastcgi --enable-force-cgi-redirect --with-oci8=instantclient,~/instantclient_11_2 && gmake && gmake install



  • Finally, to configure Oracle iPlanet Web Server 7 with PHP, you will need to download Oracle iPlanet Web Server 7 from hereand install . Please refer to this screencast, if you need help in installation. Once the installation is completed, let us run the following commands to successfully configure and run PHP scripts within Oracle iPlanet Web Server 7.

  • [sriramn@sriramn:~:$] cd ~/sun/webserver7

    Ensure that Oracle iPlanet Web Server's Administration Server is running :

    [sriramn@sriramn:webserver7:$]./admin-server/bin/startserv

    Now, let us create a new configuration within Web Server 7. For more understanding on what is a configuration, please refer to our documentation in here.

    You will need to provide the appropriate hostname of your machine for --server-name= argument

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-config --user=admin --http-port=80 --server-name=sriramn php

    Considering that I plan to only use to PHP within this configuration, I have disabled the bundled Web Container . It is up to you to decide what will be your requirements.

    [sriramn@sriramn:webserver7:$] ./bin/wadm disable-java --user=admin --config=php

    Now, let us configure PHP as FastCGI . Here, you will need to change appropriately to reflect your PHP location. This setup is expecting your php.ini to reside under your PHP installation directory/lib/php directory.

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-mime-type --user=admin --config=php-cgi --extensions=php,php4,php5 --vs=php-cgi magnus-internal/php

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-fastcgi-handler --user=admin --config=php-cgi --vs=php-cgi --mime-type=magnus-internal/php --role=responder --app-path="/home/sriramn/php-52/bin/php-cgi" --app-env="PHPRC=/home/sriramn/php-52/lib/php" --app-env="LD_LIBRARY_PATH=/home/sriramn/php-52/lib/php"

    # Finally, deploy this configuration to create an instance and followed by starting it.

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-instance --config=php sriramn

    [sriramn@sriramn:webserver7:$] ./bin/wadm start-instance --config=php sriramn

Now you will need to edit your PHP.ini to provide your Oracle Database connectivity information to connect to Oracle Database from PHP running as FastCGI within Oracle iPlanet Web Server.





Read More about [Deploying PHP with FastCGI and OCI8 extension for iPlanet Web Server 7...