Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting PHP to Sybase

Status
Not open for further replies.

jxfish2

Technical User
Jan 24, 2002
183
US
I'm trying to connect to a Sybase database, using PHP.

I'm not getting any syntax errors, or any errors for that matter.

It appears as if I might be connecting to the database, but nothing else seems to work, after the initial connection.

Once the connection is made (if it's really made), none of my debugging statements, echo / print, etc. work...

If I put in an erroneous sybase_connect statement, or an invalid database, I get an error...

But, when the database is correct, I just get a blank webpage... Or it's blank, from the point where the database connection is made... (Anything before the connection is displayed as it's supposed to be, on the webpage...)

Here's an excerpt from my PHP script:

<?php
$SERVER = 'VHost_in_interfaces_file';
$UID = 'user';
$PWD = 'user_passwd';

print &quot;$SERVER $UID $PWD&quot;;

@$db = sybase_connect($SERVER,$UID,$PWD);
$query = &quot;select name from sysobjects where type = 'U'&quot;;
@$result = sybase_query($query,$db);
print &quot;result equals: $result&quot;;
?>

NOTE: All output seems to stop, right after the &quot;@$db =&quot; line...

Any help would be greatly appreciated...

TIA

JoeF
 
I noted someone else's MySQL code, and modified my sybase query, to reflect their code:

<?php
$SERVER = VHost_in_interfaces_file';
$UID = 'user';
$PWD = 'user_passwd';

print &quot;$SERVER $UID $PWD&quot;;

sybase_connect($SERVER,$UID,$PWD);
sybase_select_db(&quot;db_name&quot;);
$query = &quot;select name from sysobjects where type = 'U'&quot;;
$result = sybase_query($query);
print &quot;result equals: $result&quot;;
sybase_close();
?>

After modifying the code, I received the following error:

Fatal error: Call to undefined function: sybase_connect() in /home/~user/public_html/main.php on line 37

Could this mean that PHP isn't compiled to work with Sybase?

What else could possibly be wrong?

Again, any help would be greatly appreciated...

JoeF
 
Use phpinfo() to determine whether php was built with sybase support.

Are you working on unix or win32 environment?

Check that apache is not linked against libdb2. In such case call to dbopen from libsybdb.so will result in a call to dbopen from libdb2.so which is loaded earlier than libsybdb.so, as a workaround either recompile apache without db2 support or link php staticaly with libsybdb.a.

 
I'm working in an HP-UX environment...

It doesn't appear as if PHP was built with Sybase support...

Unfortunately, PHP is installed by default, when Apache is installed, and HP has everything already pre-packaged...

I don't have authorization on this machine, to reinstall Apache, or PHP, and don't know how to modify HP's installation programs, even if I did have authorization...

Is there a configuration file that I can configure, to tell PHP to support Sybase?

TIA

JoeF.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top