After upgrading to OS X 10.9 Maverick, i’ve to reinstall PHP library and reconfigure it. Oracle OCI8 is one of PHP libraries which need to be reconfigured.
Today i spend more than 2 hours just to find out how to enable Oracle OCI8 in PHP 5.4.24. So I post it here just in case i have to reconfigure it again, i don’t have to feel the pain again.
Lets Start!
- Download Oracle Client Library from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
You have to download 3 files:- instantclient-basic-macos.x64-11.2.0.3.0.zip
- instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
- instantclient-sdk-macos.x64-11.2.0.3.0.zip
After downloading 3 files above, you have to extract instantclient-basic and instantclient-plus zip files into one folder, for example in “/Applications/instantclient”. And then create folder named “sdk” inside that folder, and extract instantclient-sdk into it. And then add symbolic link using this command in Terminal:
ln -s libclntsh.dylib.11.1 libclntsh.dylib
- Download oci8 tar PECL package from http://pecl.php.net/package/oci8
After downloading package from pecl, extract it anywhere you like. And then open “Terminal” and go to that folder. Then run commands below.phpize
./configure --with-oci8=shared,instantclient,/Applications/instantclient
make
sudo make install
Edit “/Applications/instantclient/” to the path where you extract Oracle Instant Client (point 1).
- Edit Apache plist file on /System/Library/LaunchDaemons/org.apache.httpd.plist
Open Apache plist using text editor and then find Environment Key section. Add DYLD_LIBRARY_PATH key and your Oracle Instant Client folder as value. - Open your /Users/yourusername/.bash_profile file using text editor, then add “export DYLD_LIBRARY_PATH=/Applications/instantclient/” (without quotes) at the end of file.
- Edit your php.ini and add “extension=oci8.so”
- Open terminal, and run this command : sudo apachectl restart
- Done! Open PHP Info
UPDATE:
If you still not getting it to work, check Sarah’s comment below.
thanks fot your sharing
It works! Thanks for saving the day!
These instructions look great, but I’m still not getting it to work. Do you have any suggestions for testing at various steps to ensure that each works? Perhaps ‘what to expect’ after each step would help.
I had to sudo a lot to get things to work (not just the one place where you said to sudo). This suggests that maybe I have a permissions issue, so I’m going to investigate that a bit. Any additional suggestions would be much appreciated.
Surely there are more than 4 of us in the world trying to do this!!
Got it!! Just in case it helps someone else…
The problem was that the versions didn’t match. I figured this out by running php from the command line. This gave me the error message.
PHP 5.5.13 still uses OCI8 version 2.0.7. (I had assumed 2.0.8; you know what happens when you ass-u-me!)
Thanks for this posting–it was a huge help.
@sarah: thanks sarah! i’ll update the post.. 🙂
Great! But to make it all work I had to change my .bash_profile file as follows:
export DYLD_LIBRARY_PATH=/Applications/instantclient/
Anyway, thanks for the guide. Best Regards.
@Marco : Thanks. I will add it to the updated post..
This is great. It was straight to the point and very very helpful. Thanks