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 18.104.22.168, 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.
[gist id=1157077 file=oci-connect-example bump=2]
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 22.214.171.124 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
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:
And reset your profile settings afterwards:
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.
Reset your ldconfig settings by executing:
And you are good to go!