简体   繁体   中英

Adding a variable to httpd.conf file stops Apache from working

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM