Reputation: 1115
i want to connect to oracle from PHP. I downloaded the php_oci8.dll library, put it in the ext directory of php, defined extension=php_oci8.dll
in my php.ini file and restarted the web server.
I get an error saying Call to undefined function oci_connect()
. I found out that php needs to be configured with --with-oci8=path_to_library
. Looking to the php configuration ( phpinfo() ) there it says --with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared
in the "configure command" section.
I am running on a windows 7 machine.
How can I change that ? And what else must I do to get it work ?
Thank you!
Upvotes: 1
Views: 4827
Reputation: 175
I created a tutorial for setting up PHP with Oracle on OS X. Can be easily transferred to Linux (though there remember to download the Oracle 10 drivers even if you are using Oracle 11).
Upvotes: 0
Reputation: 13536
Install an Oracle client on the web server (I suspect you didn't). You need at least something like Oracle Instant Client to connect to Oracle.
Follow the advice in the PHP Manual on how to setup your environment. That page also has a nice section on troubleshooting BTW.
Upvotes: 0
Reputation: 360872
The --with stuff is only if you want to compile a library directly into PHP. If adding the 'extension' argument didn't load the oracle library, then check that you modified the correct php.ini. Or had the correct path listed for the .dll.
There's usually two php.ini's. One for webserver operations, and one for command line.
You can see what the current configuration is with phpinfo()
. If the Oracle extension's loaded, there'll be a section with its config options listed.
Upvotes: 1