My project requires me to use remote oracle service, so I installed oci8 on my Mac os x 10.9.1. Then I use php -m to list all the loaded modules. I can see oci8 is there. But if I use phpinfo() in the web browser, oci8 doesn't list. I tried a few php code lines to connect to remote oracle server, there's no response on the webpage. Does anyone know where the problem is?
Asked
Active
Viewed 424 times
0
-
Have you installed oracle instant client? Or maybe the module is loaded only for cli? If you forgot to restart your webserver then you also won't see the module listed. – Lajos Veres Jan 23 '14 at 09:08
-
i installed instantclient, sdk and sqlplus. I can connect to remote oracle server through sqlplus. I've restarted webserver many times. Have no idea about what happens.. – user1301460 Jan 24 '14 at 03:36
-
Yes. you are right. the module is loaded only for CLI. for the same code, if I use "php index.php", it works in CLI. If I open this file in browser, it doesn't work. – user1301460 Jan 24 '14 at 04:31
-
Then you should add the extension=oci8; line to the php apache module config also. (/etc/php5/apache/php.ini or something similar.) (And probably safer to copy the line from the cli config file.) – Lajos Veres Jan 24 '14 at 09:11
1 Answers
1
Yeah. I solve it after 3 days search online. Add "DYLD_LIBRARY_PATH" and "LD_LIBRARY_PATH", which direct to your oracle library into /System/Library/LaunchDaemons/org.apache.httpd.plist under EnvironmentVariables.
Then, use "sudo apachectl restart" to restart apache server, oci8 extension is successfully loaded on apache. This can be checked by phpinfo().
Hope this helps others who have the same problem with me:)

user1301460
- 25
- 6
-
Quick note: LD_LIBRARY_PATH is not necessary! As stated in this guide that worked for me: http://www.baldwhiteguy.co.nz/technical/index_files/mac-osx-oci8-oracle-php.html – Annie Caron Jun 15 '15 at 19:50