Zend Server – Oracle Instant Client

Zend Server has out-of-the-box support for connectivity to Oracle databases, minimizing the time required for setting up a PHP stack. The built-in support has been limited though. From our point of view it’s just the a size issue. The complete Oracle Instant Client is over 100Mb, which is about half of the whole default Zend Server installation.

The implementation of Oracle OCI in Zend Server 5.1 is based on the Oracle Instant Client Basic Lite version 11.2.0.2, which has support for following connectivity features:

  • English error messages
  • Unicode, ASCII, and Western European character sets

So far so good. A connection to an Oracle database is easily made with a few pieces of PHP code.

But what if you receive the following error:

ORA-12737: Instant Client Light: unsupported server character set WE8ISO8859P15

What??? Didn’t we have support for Western-European character sets? Isn’t ISO-8859-15 just ISO-8859-1 with Euro sign support and few language specific characters?

So the out-of-the-box solution doesn’t suffice anymore. Tweaking time! On the Zend forums a solution can be found which really works well for Zend Server.

What if you’re running command line scripts that execute PHP commands? The following changes were made on a CentOS x86_64 machine, but any RHEL type should work out.
Download and install the RPM of Oracle Instant Client 11.2.0.2 Basic.

Create a .sh file in your /etc/profile.d directory, in this case we named it ‘oracle-instant-client-zend-server.sh’:

if [ -z $LD_LIBRARY_PATH ];then
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/lib/oracle/11.2/client64/lib:/usr/local/zend/lib
else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/11.2/client64/lib:/usr/local/zend/lib
fi
export LD_LIBRARY_PATH
export ORACLE_HOME=/usr/lib/oracle/11.2/client64/lib

Set execution rights on the file;

chmod 755 oracle-instant-client-zend-server.sh

Edit your zce.rc file in /etc and the following line as the first line in the file:

. /etc/profile.d/oracle-instant-client-zend-server.sh

And reset your profile settings afterwards:

source /etc/profile

After this stage you should be able to execute scripts from the command line and in Zend Server. But still the tweaking wasn’t over.
The cron deamon won’t pick up the correct libraries because it doesn’t use the same profile settings. To solve this issue one more file has to be edited: /etc/ld.so.conf.d/zend_server.conf

Add the following line before the /usr/lib64 line. Because that is where the liboci8-zend RPM installs the Basic Lite version libraries.

/usr/lib/oracle/11.2/client64/lib

Reset your ldconfig settings by executing:

ldconfig

And you are good to go!

Showing 7 comments
  • Nestor Waldyd
    Beantwoorden

    Hello,

    Thanks for your post.

    I have a similar problem (http://forums.zend.com/viewtopic.php?f=44&t=107248). I also have tried to apply your solution with no success… Would you please suggest me any other solutions?

    Best Regards,
    Nestor Waldyd

    • Jeroen van Dijk
      Beantwoorden

      What type of error do you get? We’ve been using this solution for 2 years in production with success including the Zend Server 5.6 release.

      • Nestor Waldyd
        Beantwoorden

        Hello,

        I am using Zend CE engine version: 2.3.0

        May this be the reason?

        • Jeroen van Dijk
          Beantwoorden

          No Zend Server CE has the same libraries as the PE edition.

    • Jeroen van Dijk
      Beantwoorden

      Hello Nestor,

      I’ve published the scripts we use, on github (https://github.com/jvandijk/zs-oracle-client). Maybe this helps in solving your problem.

      Regards,

      Jeroen

  • Mavis
    Beantwoorden

    I see you share interesting things here, you can earn some extra
    money, your blog has big potential, for the monetizing method, just search in google
    – K2 advices how to monetize a website

  • Venetta
    Beantwoorden

    I read a lot of interesting content here. Probably you
    spend a lot of time writing, i know how to save you a lot of time, there is an online tool that creates readable,
    google friendly articles in minutes, just type in google – laranitas free content source

Reageer

Start typing to search