After fixed error in invoking target ‘mkldflags ntcontab.o nnfgt.o’ on Oracle Database 11g R2 64 bit. Later it is about the web/application servers, install apache and php5 standard modules and connect from PHP to oracle via OCI8 package.

At first you must installed php-pear package before using pecl install oci8 command.


There is no OCI8 entry in phpinfo() output, but php -i on command line found OCI8 module.
The Loaded Configuration File of phpinfo() and php-i point at the same path : : /etc/php.ini .

OCI8 Support => enabled
Version => 1.4.9
Revision => $Id: e2241cffb72c940cb2ca267b7a6a0ce436de7e5e $
Active Persistent Connections => 0
Active Connections => 0
Oracle Run-time Client Library Version =>
Oracle Version => 11.2
Compile-time ORACLE_HOME => /u01/app/oracle/product/11.2.0/dbhome_1
Libraries Used => -Wl,-rpath,/u01/app/oracle/product/11.2.0/dbhome_1/lib -L/u01/app/oracle/product/11.2.0/dbhome_1/lib -lclntsh
Temporary Lob support => enabled
Collections support => enabled

Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value => Off => Off

When checked the apache error log file in /var/log/httpd/error_log — got warning message :

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/’ – cannot open shared object file: No such file or directory in Unknown on line 0


However, as I said, there is no OCI8 entry in phpinfo() output and found OCI8 module at php command line.
Think about oracle environments missing as following:

  • when you install OCI8 by using pecl command , don’t forget oracle envs in ~/.bash_profile of root user
  • Put oracle environments in the apache configuration settings file, /etc/sysconfig/httpd

Go down to Installation Task to see oracle environments of 2 sections above !

Before Installation Task


Before the installation I disabled SELinux by edit config file (basic change) and restart to take effect.

The file content is something similar to the following :

Comment SELINUX=enforcing and copy to new line, and change value to disabled
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
# targeted – Targeted processes are protected,
# mls – Multi Level Security protection.

Reboot system !

php-pear is installed or not ?

Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Installed Packages
php-pear.noarch                       1:1.9.4-4.el6                        @base

if not install used yum install php-pear or rpm -ivh command that you bold.

Installation Tasks

Edit root ~/.bash_profile


Logout and Login again to read new environment parameters

or run above command to read new parameters.

Install oci8

Build process completed successfully
Installing ‘/usr/lib64/php/modules/’
install ok: channel://
configuration option “php_ini” is not set to php.ini location
You should add “” to php.ini

Create new file /etc/php.d/oci8.ini

; Enable oci8 extension module

Oracle environment variables for Apache

Here is what I added at the end of the file /etc/sysconfig/httpd


Once this is done, restart httpd

oci8 enabled on phpinfo()

If everything went well, normally you will see the OCI8 entry if you run phpinfo() in a test PHP script on webpage.
Hope this may help my online IT friends !

Recent Unable to load dynamic library '/usr/lib64/php/modules/' - Search Terms:

  • - /usr/lib64/php/modules/oci8 so ( (1)
Unable to load dynamic library ‘/usr/lib64/php/modules/’ –