1

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!

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

3 Comments

Now I got it working, using the instructions on oracle.com/technetwork/articles/… I am using Oracle Instant Client now, but on that page it states that it would work without it. That means only PHP and the Oracle DB server. I will try that also.
It states that it only works without Instant Client when the Oracle DB is installed on the same server as the webserver (as in that case, the database libraries can be used). If that describes your situation, you shouldn't need to install an extra Oracle client.
Yes, you are right. In my development environment, this is the case. Although, I did not succeed (yet) to get it working without the instant client.
0

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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.