The other day, in my review of
PHP Oracle Web Development, I mentioned that I was having problems enabling the oracle extension on Fedora 8. I really didn't need to get it running, but the sheer fact that I tried it and it wouldn't work, pissed me off enough to spend some time getting it resolved. Hopefully this helps anyone else having the same problem. I am currently using instant client 11.1, but I did try the 10.2 version with the same results. I assume that the steps I went through to get it working are the same for that version as well (other than the different directory). Anyways, the issue was a bit strange. When trying to run the configure script, I would receive the error:
cannot compute sizeof char*
This would only happen when the oracle extension (ext/oci8 or ext/pdo-oci) was enabled. So I started poking around the config.log and the oracle m4 file. The first thing I noticed was that libaio was missing. Having become so used to rpms detailing their dependencies (and the intstant client installing without issue), I hadn't realized that the instant client needed this lib. After a quick, yum install libaio, I tried again, yet still hit the same issue.
This time poking around some more I noticed in my server logs that SELinux was not allowing the oracle libraries to load. Researching this issue was of no help. All the advice and instructions I found when for working with PHP and SELinux was to disable SELinux. I do not buy into this. In fact, all my publicly accessible servers and workstations run with SELinux in enforcing mode. I figure why not protect my systems as much as I can when its available to me.
At this point, I thought I was in the clear. All I needed to do was allow text relocation:
chcon -t texrel_shlib_t /usr/lib/oracle/11.1.0.1/client/lib/*.so
After executing this, the configure script completed successfully and I was able to build PHP with the oracle extension. Too bad it didn't end here. Upon installing PHP, I restarted apache (or at least tried to), just to hit the next error. The php module would fail to load because it was being denied permission to load the oracle libraries. The logs pointed to the fact that it could not enable executable stack. A quick check of the oracle libraries shows that the libraries require executable stack:
execstack -q /usr/lib/oracle/11.1.0.1/client/lib/*.so*
X /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so
X /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so.11.1
X /usr/lib/oracle/11.1.0.1/client/lib/libnnz11.so
X /usr/lib/oracle/11.1.0.1/client/lib/libocci.so
X /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
- /usr/lib/oracle/11.1.0.1/client/lib/libociei.so
X /usr/lib/oracle/11.1.0.1/client/lib/libocijdbc11.so
I really have no idea if it is required or not. I am not using instant client for anything other than accessing Oracle from PHP, so I decided to clear the executable stack flag on the libraries causing the problems and see what happened.
execstack -c /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so
execstack -c /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so.11.1
execstack -c /usr/lib/oracle/11.1.0.1/client/lib/libnnz11.so
I crossed my fingers and restarted apache. Thankfully, apache started right up and my logs were clean. Testing so far has gone well. Scripts run from both CLI and within apache have been working fine with oracle. I still have yet to find out whether the executable stack flag is really required or not, but until the time someone tells me otherwise or I run into issues, these changes seem to have fixed my problem.
The good folks from Packt Publishing were kind enough to send me a few books to review and I've been a little lax posting a review, so over the next few days I hope to have them all up. Overall I would have to say that PHP Oracle Web Development is a good
Tracked: Dec 19, 13:52
Rob Richards mentioned in a previous book review about some of ...
Tracked: Dec 20, 15:19