473,790 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle connection problem: PHP, IIS, and OCI8

2 New Member
Hi,

We're having problems connecting to an Oracle 9i db using PHP 5.2.1 and OCI8. Also, we are using IIS 5.1.

PHP is working--we can see the info.php page. On the info.php page I see that OCI8 is enabled.

But a simple page with an Oracle connection like this returns only 'hello' from the print statement and then nothing:

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php print("hello"); ?>
<?php
$conn = OCILogon([user], [pwd], [tnsnames entry]);
$query = 'select table_name from user_tables';
$stid = OCIParse($conn, $query);
OCIExecute($sti d, OCI_DEFAULT);
while ($succ = OCIFetchInto($s tid, $row)) {
foreach ($row as $item) {
echo $item." ";
}
echo "<br>\n";
}
OCILogoff($conn );
?>
</body>
</html>

The path seems correct. The first entry is the PHP directory and the 2nd entry is the Oracle directory where the OCI .dlls reside.

The same login/pwd@tns_entry can be accessed through sqlplus located in the same directory as the OCI .dlls.

Any help will be greatly appreciated.
Mar 15 '07 #1
1 5661
Steve1000
2 New Member
OK, the problem was with our Oracle client setup. The TNSNames.Ora file that we were using had entries that ended with '.world'. We were originally using Oracle's instant client which doesn't have a sqlnet.ora configuration file. We installed the standard Oracle 10g client instead and configured the sqlnet.ora file so that it included this line:
NAMES.DEFAULT_D OMAIN = WORLD

Surprisingly to me, sqlplus worked when we had the instant client installed even though the OCI dlls used by PHP did not.

I believe the instant client can be made to work as well even with the '.world' entries by adding some configuration information to the tnsnames.ora file. But I have not tried this out.

I hope this is helpful to somebody.
Mar 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
11028
by: Geoff Muldoon | last post by:
Hi all, Help please. Environment: Unix (Tru64) / Apache / PHP4.0.6 / Oracle8i Establish connection to Oracle: for ($I=0; $I<$max_attempts; $I++) {
3
12690
by: Chad The Man | last post by:
I have been developing some applications on suse 9 / apache 1.37 / php 4.3.4 / Oracle 9i / OCI8. We recently moved servers, apache works fine, php works fine, oracle works fine... however, trying to connect to oracle from php it dies with the following error : Warning: ocilogon(): _oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX: OCI_INVALID_HANDLE Using SQL plus I can connect just fine. The variables are all set in apache and the...
2
3713
by: jayPLEASEtylerNOwilliamsSPAM | last post by:
Hi, I set up PHP 4.xx using Apache 1.3 on Windows XP to begin a project. The project now needs to be moved to a real test box. Admittedly, I am not quite sure how I was able to access Oracle on my machine, but I know I have the Oracle client installed, have two odbc DSNs (CAI/PT Oracle 8) installed and uncommented php_oci8.dll and php_oracle.dll. Other than that, I kind of just played around until it worked. Now my code needs to be...
3
17892
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2364) at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:480)
6
6336
by: DravenStone | last post by:
Hi, I had just a horrible day at work, spent pretty much the entire day trying to get php_oci.dll and php_oracle.dll to load. It still never did. Super Quick Background. Jack of all trades IT guy, have written many tools using perl and JSP in the past. Had a chance to do a big project, and figured I would use it to learn PHP.
9
2052
by: Keith E. Sauvant | last post by:
Hi, we got a strange problem connecting to an Oracle database onsite with our PHP application: During CSV import job handled by our application, PHP opens up to some hundred connections to the database. It then eventually fails to connect to the database due to the high number of open connections. We are not able to reproduce this behaviour on our internal installations, we get up to 30 connections until the job is finished.
6
4677
by: hegyvari | last post by:
Hi, I have a few apps written in PHP, running on Fedora Core. After porting these applications from PostgreSQL to Oracle a bug appeared: sometimes, not in a reproducable manner, the web page does not appear in the browser and after examining the html source in the browser I notice that the code is cut in half, somewhere after about the first 3-4 kbytes. It happens quite often, once in every two minutes. The problem was not
1
3457
by: burtonl | last post by:
I'm using the ADODB abstraction layer and trying to figure out how to call an Oracle stored procedure. It has the following types defined: CREATE OR REPLACE TYPE varchar2_3200_array IS TABLE OF VARCHAR2(3200); / CREATE OR REPLACE TYPE number_array IS TABLE OF NUMBER; /
0
4791
by: Yannick | last post by:
Hi, I'm Julien from France, We have recently install a new Web Server for my company The server is composed : - Linux RedHat RHEL4 U4 - Httpd-2.0.52-27.ent - Oracle Database 10.2.0.1
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10201
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6770
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.