Question

I'll make this quick.

I installed Oracle 11g (with appropriate database, users, etc), Apache 2.4.6, and PHP 5.5.4 on a Fedora 19 system.

I wanted to connect PHP to Oracle. What I really wanted to do was to download MDB2_Driver_oci8, which I thought would be easy, but before I can do such a thing, PHP needs to have that plug-in enabled, so here's what I did:

  • Tried to install oci8 via the following: pecl install oci8
  • When that didn't exactly work the first few times, I figured out I, for some reason, needed "Development tools" - via yum groupinstall "Development Tools"
  • Then I figured out later that PHP actually doesn't do oci8 - it's PHP Devel. So, I had to install that too, via yum install php-devel.
  • And then, I finally got to install oci8. It asked for the Oracle Directory, and that was that. But it said the following:
    Configuration option 'php_ini' is not set to php.ini location
    You should add 'extensions=oci8.so' to php.ini

First, I did a locate oci8.so - found it in /usr/lib64/php/modules/
Second, I added what it told me to, to the php.ini file.
Third, I checked the usual php_info() test page - no mention of OCI8. Uh-oh.
Fourth, running both php -i and php -m listed oci8 as one of the modules. Weird.
In desperation, I went ahead and downloaded the MDB2_Driver_oci8. Maybe that will fix things. Nope.

When I loaded my PHP Webpage, it returned the following:
Error message: extension oci8 is not compiled into PHP
As well as: MDB2 error: not found

Strange. And then I decided to check the error logs:
PHP Startup - unable to load dynamic library '/usr/lib64/php/modules/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0

And now I'm stuck. I tried going into the php.ini, and found that the extension_dir was commented out. I put it back in, which only seemed to break stuff.

Things of note:

  • I followed this (link) guide on how to configure PHP and install oci8.
  • ./configure --with-oci8 doesn't work. Fedora says no such directory.
  • As both the webpage files and the actual server reside on the same PC, I did not install the Oracle Client files.
  • The extension_dir is commented out by default in the php.ini.

This is just one of my problems in a long line of problems concerning the replication of an already existing and working, but dying, setup. It seems whenever I want to solve a problem, I have to do X first. And by doing X, I uncover another problem, which I have to solve by doing Y, which has its own problems, etc, etc.

Any help would be much appreciated. Thanks.

Was it helpful?

Solution 2

After reading a lot on the internet, I found this page, that indicates I should disable SELinux, and reboot.

That did the trick.

OTHER TIPS

I know this question is a bit old - but I'm writing this here incase others come looking for the solution.

PHP Extensions Directory

To get your PHP extensions directory, run this command

php-config --extension-dir

ORACLE configuration

When you run the config command for oracle, you need to provide it with your Oracle Home directory (this assumes you have installed ORACLE XE):

./configure -with-oci8=shared,$ORACLE_HOME/xe

SELinux policy

You need to adapt your SELinux policy to support what you are trying to achieve. Disabling it completely is not recommended.

On your Fedora system, try running:

which audit2allow

If you receive an error that indicates it cannot find audit2allow then you need to install this package:

yum install policycoreutils-python

Once you have this package, you can pipe your audit log files into audit2allow to have it create your policy file:

grep httpd /var/log/audit/audit.log | audit2allow -m httpd > http.te

This will create the file http.te that is human readable for you to review what the policy additions are that it will make to your SELinux configuration. If you are OK with the modifications, then run these commands (note the capital M in the following command vs. the lowercase m previously)

grep httpd /var/log/audit/audit.log | audit2allow -M httpd
semodule -i httpd.pp

This may take a few seconds to run - you can verify the policy has been installed by running:

semodule -l | grep httpd

You will need to restart httpd so that it can try to load the oci8.so plugin

service httpd restart

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top