Re: Connecting to Sybase ACE 11.9.2 db (InterShop4) **FIXED?**
| From: | Eric McKeown | Date: | Sun, 11 Jun 2000 05:43:48 +0000 |
| Subject: | Re: Connecting to Sybase ACE 11.9.2 db (InterShop4) **FIXED?** | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-311@lists.php.net to get a copy of this message | ||
Graham Paul Wooden wrote:
> Eric,
> I added that export into /etc/profile, and it seems to be working.
> Can you or someone verify this?
Sorry for the long delay in replying to this, but I float in and out of this
list every few days when I get time. From what I see below, it looks like
you're connecting just fine. Try issuing some queries, and you should be set.
When I need to get the SYBASE environment variable set properly for the
webserver user id, I just put it in the startup script for the server. For
instance, I may have a startup script that looks like....
#! /bin/bash
export SYBASE=/opt/sybase
/www/bin/httpd -d /www
And I start the server as root in order to have the user id switched once the
server is started. Anyway, that's how I do it, and YMMV.
Eric
>
> ---[buffer]---
> <?php
> $user="sa";
> $pass="*****";
> $host="ISSERVER";
> $db="tridia";
> echo ("SYBASE CONNECTION: -->");
> echo ("Attempting to connect ...");
> $link_id = sybase_connect($host, $user, $pass);
> if ($link_id == 1){
> echo ("Connected.");
> }
> if ($link_id == 0){
> echo ("Connection Failed.");
> }
> $initialA = sybase_select_db($db, $link_id);
> if ($initialA == 1){
> echo (" .. Selection made.");
> }
> if ($initialA == 0){
> echo (" .. Selection Failed.");
> }
> ?>
> ---[end buffer]---
>
> SYBASE CONNECTION: -->Attempting to connect ...Connected. .. Selection made.
>
> So, it's working right? I am going to try a select statement after I figure
> our what tables I have...
>
> Thanks all!
>
> -----Original Message-----
> From: Graham Paul Wooden [mailto:graham@tridia.com]
> Sent: Wednesday, June 07, 2000 8:45 AM
> To: ericm@palaver.net
> Cc: php-db@lists.php.net
> Subject: RE: [PHP-DB] Connecting to Sybase ACE 11.9.2 db (InterShop4)
>
> Hi Eric,
> Yes, I do have Sybase compiled in.
> I am not sure how to check for errors, though? Any hints maybe with the type
> of code I have written below?
>
> How would I set the environment variable? You mean "echo $SYBASE" should say
> /InterShop4/sybase ?
> Set the inside the user's .profile (or another one) I presume right?
> I tried to set this is inside the .bash_profile of the webserver user:
> export SYBASE=/InterShop4/sybase
>
> but when I su - over to that user, and do a echo $SYBASE, it displays
> nothing...
>
> Thanks Eric, please let me know what you think!
>
> -Graham.
>
> -----Original Message-----
> From: ericm@ns.palaver.net [mailto:ericm@ns.palaver.net]On Behalf Of
> Eric McKeown
> Sent: Wednesday, June 07, 2000 5:10 AM
> To: Graham Paul Wooden
> Cc: php-db@lists.php.net
> Subject: Re: [PHP-DB] Connecting to Sybase ACE 11.9.2 db (InterShop4)
>
> If it failing silently, or are you getting an error message? You may try
> tweaking your error reporting setting in order to see the error message.
>
> Also, when you start the Web server, try setting the Web server user's
> SYBASE
> environment variable to the directory where your interfaces file resides.
> Are you sure you've got Sybase support compiled into PHP? Does Sybase
> support
> show up on a page where you call phpinfo() ??
>
> Eric
>
> Graham Paul Wooden wrote:
>
> > OS = Linux, RedHat 6.1 with the stock 2.2.12 kernel.
> > PHP = 3.0.16, compiled as shared with MySQL and Sybase (sometimes with
> > Sybase-CT).
> > Apache = 1.3.9, compiled from the source.
> > Sybase = 11.9.2 Adaptive Server Enterprise, from InterShop4 ( e-commerce).
> >
> > Hello All,
> >
> > I am having one hell of a time connecting to a database on the same
> machine
> > as the webserver.
> > You would think it would be simple, but no. it is not.
> >
> > Right out of the bat, I am getting:
> >
> > Warning: 0 is not a Sybase link index in /home/httpd/html/sybase.php3 on
> > line 7
> >
> > Here is what my code looks like,
> > <?php
> > $user="sa";
> > $pass="*****";
> > $host="ISSERVER";
> > $db="tridia";
> > $link_id = sybase_connect($host, $user, $pass);
> > $initialA = sybase_select_db($db, $link_id);
> > ?>
> >
> > So its complaining about the select_db line.... actually it has problems
> > from the very beginning.
> > $link_id is returning a 0, which means its not connecting.... I did an
> "echo
> > $link_id "...
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net