1

In my efforts to solve an OCI8 error, I've been led to believe it is the result of an improperly setup environment variable.

What I'm trying to do: Fix this apache environment headache, by adding variables to a certain file.

My actual problem is similar to this error from another StackOverflow user. To quote his answer to his problem:

Problem solved! To put variables in Apache's Environment section you just have to add them in /etc/sysconfig/apache2 file: LD_LIBRARY_PATH=/path/to/oracle/lib.

Notably, the solution called for the modification of the file apache2.

However, I found no such apache2 file on my system.

What I've done so far:

I searched over the net, but the closest I could come up with is /etc/httpd/conf/httpd.conf file. Assuming the httpd.conf is apache2, according to this thread, I should add the variable to the end of the file, and it should work.

So I added export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib at the very end of the file.

And... apache won't even start anymore.

My system:

It's a Fedora 19 server, with Oracle 11g, PHP 5.5.4, Apache 2.4.6, and PEAR 1.9.4. In addition to this, I have the OCI8 plug-in for PHP downloaded and enabled, and have downloaded MDB2 and the MDB2_Driver_oci8.

Apache starts automatically when I boot up my system, though if for some reason I need to stop, restart, or check its status, the command I use is systemctl start httpd.service, if it means anything.

Thanks. I've been pulling my hair out on this problem.

Community
  • 1
  • 1
zack_falcon
  • 4,186
  • 20
  • 62
  • 108
  • 2
    I'm not sure what an apache2 file is myself. `httpd.conf` is the Apache config file (for all versions of Apache). A better question is what are you trying to do? – Machavity Nov 21 '13 at 04:27
  • could it be here /etc/apache2/apache2.conf. That is where mine is on ubuntu – Jacob Nov 21 '13 at 04:35
  • okay, I just looked on my centos server and the same file is /etc/httpd/conf/httpd.conf – Jacob Nov 21 '13 at 04:38
  • Yeah, fedora/centos/redhat use "httpd" instead of "apache2" – Dagg Nabbit Nov 21 '13 at 04:39
  • Sorry for the vague question. I've updated it to a hopefully more understandable format. As for `httpd.conf`, I did try modifying it, but it only broke apache. – zack_falcon Nov 21 '13 at 04:52

1 Answers1

1

A few things (hopefully an answer is somewhere inside)

First off, I wouldn't do this on Fedora. Fedora is the testbed for RedHat Enterprise/CentOS and it changes frequently. Even if this is just for your testing purposes, you'll find better support if you install CentOS 6 instead. The environment is virtually identical, but CentOS is better supported because so many people use it to run their servers.

Second, it sounds like you want to run the OCI8 connector (there's a reason I plugged CentOS 6). CentOS has many good repos like Remi. If you install CentOS 6 you can use his repository. This is important because this will save you a LOT of headaches down the road. Once you have his repo installed, you can do this

yum install php-oci8

And that should configure Apache to run your OCI8 extension. It's really that simple.

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • Yes, I've considered CentOS, but I've strict orders to replicate an existing Fedora setup. And yes, I am trying to get it to connect to an Oracle database, via OCI8, though I've encountered a LOT of errors, and this question is just one small step in one giant problem. In any case, can I try that command on Fedora? However, I've previously ran `yum install php` and later, `yum install php-devel` - will there be complications? – zack_falcon Nov 21 '13 at 05:14
  • No problems there. In fact, the command I referenced above would have done that for you. `php-devel` is necessary to compile your own PECL libraries. You can see all the php packages you've installed by using `rpm -qa php*`. Remi has a Fedora repo so try installing that repo and then run that command. What you're saying is "yum, find a repository with that package and install it". – Machavity Nov 21 '13 at 13:21
  • I ran `yum install php-oci8`, but strangely, it says no package available. – zack_falcon Nov 22 '13 at 09:14
  • Did you install the Remi repo first? (link in my post). i see that package listed in his repo for Fedora 19 http://rpms.famillecollet.com/fedora/19/remi/x86_64/repoview/development.languages.group.html – Machavity Nov 22 '13 at 13:22
  • Sorry for the late reply. Yes, I installed `wget`, then I typed in `wget http://rpms.famillecollet.com/remi-release-19.rpm`, followed by `yum install remi-release-19.rpm`, and finally, `yum install php-oci8`. I'm not sure about this, but doing a `yum list installed | grep remi` produced only three results - `remi-release.noarch`, 19-1.fc19.remi` and `@/remi-release-19` – zack_falcon Nov 25 '13 at 03:32
  • Oh, I see why. He compiled that against 5.5. Head over to your `/etc/yum.repos.d/remi.repo` file and under the PHP 5.5 repo change `enabled=0` to `enabled=1`. Make sure it's not the test or dev repo. Then run `yum update -y` – Machavity Nov 25 '13 at 03:52
  • Did that, thanks. I've been able to `yum install php-oci8`, though now I'm encountering problems I had solved* before: `Unable to load dynamic library`, as well as `oci8 is not compiled into PHP`. Still can't add anything to the bottom of httpd.conf, though. Hmmm. – zack_falcon Nov 25 '13 at 08:19
  • When you add a package this way it doesn't append `php.ini` directly. Instead, it puts a file in your `/etc/php.d` directory (in the same way it's recommended you put your site configs in `/etc/httpd/conf.d`). Try running `phpinfo()` and see if it lists oci8 there. – Machavity Nov 25 '13 at 13:50
  • I see the oci8.ini file in the directory `/etc/php.d/`, but it's only listed under module authors when I run `phpinfo()`. I vaguely remember having to manually add `oci8.so` in a file somewhere (php.ini, iirc). – zack_falcon Nov 26 '13 at 03:19
  • You might want to remove that reference then since `oci8.ini` will also contain that .so file – Machavity Nov 26 '13 at 13:14
  • I did, thanks, though to no effect. I'm prodding at it - seems as if oci8 wasn't installed or isn't recognized, hence the "oci8 is not compiled into PHP" - doesn't appear either when running `php --ri oci8` or `php -i`. – zack_falcon Nov 27 '13 at 06:18