Re: Bug #1665: Can't logon and execute SQL statements on
| From: | Mark Britton | Date: | Tue, 06 Jul 1999 14:34:55 +0000 |
| Subject: | Re: Bug #1665: Can't logon and execute SQL statements on | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8123@lists.php.net to get a copy of this message | ||
I'll have to send you the scripts this evening, since I'm at work now. If
you are using the ora_login, you should be able to just put:
putenv('ORACLE_SID=orcl');
putenv('ORACLE_HOME=/u01/app/oracle/product/8.0.5');
(put in your correct values for the ORACLE_SID and ORACLE_HOME)
in your script before the ora_logon call. Make sure the listener is up on
the db server and running and that you have the oracle client libraries
installed on the machine that you're running apache/php on.
On Tue, 6 Jul 1999 10:08:17 -0300 (EST), Wagner Bila - Aluno Graduacao -
Regina wrote:
>
> Hi Mark,
>
> Yes, i would like to receive all the scripts you're using. I made a
> similar script but it didn't work ! I'll try what you sent me but i'd
like
> to have the scripts source ' cause if it doesn't work i'll have your
> scripts to look !
> Mark, thanks again and sorry for bother you !
>
> Regards,
>
> Wagner
> wsb@dc.ufscar.br
>
>
> On Tue, 6 Jul 1999, Mark Britton wrote:
>
> > I have a script in my profile.d directory called oracle.sh that contains
the
> > following:
> > export ORACLE_SID=orcl
> > export ORAENV_ASK=NO
> > . /usr/local/bin/oraenv
> > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
> > export ORAENV_ASK=
> >
> > Then, in the section of code for starting apache in
> > /var/lib/apache_1.3.6/bin/apachectl
> > I added:
> > . /etc/profile.d/oracle.sh
> >
> > This probably is not the proper way, but it works. Redhat executes all
the
> > scripts in /etc/profile.d at login time for all users, but it didn't
seem to
> > work for the apache user (which I think runs as nobody on my system),
so
> > that's why I put in the apachectl script. I can send you the actual
scripts
> > if you wish....
> >
> > Mark Britton
> > mbritton@verinet.com
> >
> >
> > ----- Original Message -----
> > From: Wagner da Silva Bila <wsb@dc.ufscar.br>
> > To: Mark Britton <mbritton@verinet.com>
> > Sent: Tuesday, July 06, 1999 12:47 AM
> > Subject: Re: [PHP-DEV] Bug #1665: Can't logon and execute SQL statements
on
> > an identified database instance !
> >
> >
> > >
> > > Mark,
> > >
> > > I can't put the Oracle Variabes at the user environment space
which
> > Apache
> > > runs. I've put a call to a script who set all the variables but it
didin't
> > work
> > > ! Could you send me what you've done, please !
> > >
> > > Thanks,
> > >
> > > Wagner
> > > wsb@dc.ufscar.br
> > >
> > >
> > > Mark Britton wrote:
> > >
> > > > I just tried this on my test system which is uses php as an apache
> > module,
> > > > and it worked...I cheated a bit and put the call to dbora in the
> > apachectl
> > > > script to make sure apache has all the environment variables set
that
> > are
> > > > needed for oracle at startup.
> > > >
> > > > Take a look at the phpinfo output and see if you have the following
> > > > environment variables set:
> > > >
> > > > ORACLE_SID
> > > > ORACLE_HOME
> > > > LD_LIBRARY_PATH should contain $ORACLE_HOME/lib
> > > > PATH should contain $ORACLE_HOME/bin
> > > >
> > > > If these variables aren't set, then the user that you're running
apache
> > > > under can't find the Oracle libraries.
> > > >
> > > > ----- Original Message -----
> > > > From: Wagner da Silva Bila <wsb@dc.ufscar.br>
> > > > To: Mark Britton <mbritton@verinet.com>
> > > > Cc: <php-dev@lists.php.net>
> > > > Sent: Monday, July 05, 1999 10:52 PM
> > > > Subject: Re: [PHP-DEV] Bug #1665: Can't logon and execute SQL
statements
> > on
> > > > an identified database instance !
> > > >
> > > > >
> > > > > Hi Mark,
> > > > >
> > > > > I've tried this before sending my bug report. This answer is
> > provided
> > > > at the
> > > > > PHP site but it seems that only works when you execute it in a
shell,
> > not
> > > > via a
> > > > > web browser (at least this is what is happening to me).
> > > > >
> > > > > Thanks anyway !
> > > > >
> > > > > Regards,
> > > > >
> > > > > Wagner
> > > > > wsb@dc.ufscar.br
> > > > >
> > > > >
> > > > > Mark Britton wrote:
> > > > >
> > > > > > Try this:
> > > > > > <?php
> > > > > > putenv("ORACLE_SID=orcl");
> > > > > > /* or whatever your ORACLE_SID is */
> > > > > > putenv("ORACLE_HOME=/u01/app/oracle/product/8.0.5"); /*
> > > > > > or
> > whatever
> > > > your
> > > > > > ORACLE_HOME is */
> > > > > >
> > > > > > $conn =
> > > > > > ocilogon("user","user_pass","ORACLE_SID");
> > > > > >
> > > > > > $stmt = ociparse($conn, "delete from testeoci");
> > > > > > ociexecute($stmt);
> > > > > > ocilogoff($conn);
> > > > > >
> > > > > > ?>
> > > > > > If this works, then you probably need to get the Oracle
environment
> > set
> > > > up
> > > > > > correctly for the user that apache runs under...I set it up so
that
> > all
> > > > > > users get the Oracle environment variables set at login.
> > > > > >
> > > > > > Mark Britton
> > > > > > mbritton@verinet.com
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: <wsb@dc.ufscar.br>
> > > > > > To: <php-dev@lists.php.net>
> > > > > > Sent: Monday, July 05, 1999 2:20 PM
> > > > > > Subject: [PHP-DEV] Bug #1665: Can't logon and execute SQL
statements
> > on
> > > > an
> > > > > > identified database instance !
> > > > > >
> > > > > > > From: wsb@dc.ufscar.br
> > > > > > > Operating system: Linux RedHat 5.2 and 6.0
> > > > > > > PHP version: 3.0.11
> > > > > > > PHP Bug Type: Oracle related
> > > > > > > Bug description: Can't logon and execute SQL statements on
an
> > > > identified
> > > > > > database instance !
> > > > > > >
> > > > > > >
> > > > > > > Hi Folks,
> > > > > > >
> > > > > > > I made two simple php3 files just to delete all data in a
table
> > called
> > > > > > "testeoci" in an Oracle 8.0.5 database instance. Both work
> > > > > > fine
when
> > i
> > > > call
> > > > > > them using the shell prompt but neither work when i call it via
a
> > Web
> > > > > > Browser ! My Web Server is an Apache 1.3.6 and my PHP version
is
> > 3.0.11.
> > > > > > Apache is running as "apache" user and i run the files on
> > > > > > the
same
> > > > account
> > > > > > as apache user ). I can't figure out what could be wrong since
all
> > the
> > > > > > variables are correctly set. Maybe it is really a bug !
> > > > > > >
> > > > > > > The files code are listed bellow :
> > > > > > >
> > > > > > > file://Test file #1
> > > > > > >
> > > > > > > <?php
> > > > > > >
> > > > > > > $conn =
> > > > > > > ocilogon("user","user_pass","ORACLE_SID");
> > > > > > >
> > > > > > > $stmt = ociparse($conn, "delete from testeoci");
> > > > > > > ociexecute($stmt);
> > > > > > > ocilogoff($conn);
> > > > > > >
> > > > > > > ?>
> > > > > > >
> > > > > > >
> > > > > > > file://Test file #2
> > > > > > >
> > > > > > > <?php
> > > > > > >
> > > > > > > $conn = ora_logon("user@ORACLE_SID",
> > > > > > > "user_pass");
> > > > > > > $cursor = ora_open($conn);
> > > > > > > ora_parse($cursor, "delete from testeoci");
> > > > > > > ora_exec($cursor);
> > > > > > > ora_logoff($conn);
> > > > > > >
> > > > > > > ?>
> > > > > > >
> > > > > > > Notes : 1 - Everything seems okay with oracle 'cause i can
connect
> > > > with
> > > > > > the related database using the sqlplus program. So, the files
> > > > 'tnsnames.ora'
> > > > > > and 'listener.ora' are ok !
> > > > > > > 2 - I have a web site running php3 scripts which
> > connects
> > > > > > successfully with an Oracle database, but they use the regular
logon
> > > > > > statement (which works fine !) : $conn =
ora_logon("user@hostname",
> > > > > > "user_pass");
> > > > > > > 3 - I've tested it over RedHat 5.2 and 6.0
producing
> > the
> > > > same
> > > > > > results !
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > PHP Development Mailing List
> > > > > > > <http://www.php.net/>
> > > > > > > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> > > > > > > For additional commands, e-mail: php-dev-help@lists.php.net
> > > > > > > To contact the list administrators, e-mail:
> > > > php-list-admin@lists.php.net
> > > > >
> > > > >
> > > > > --
> > > > > PHP Development Mailing List
> > > > > <http://www.php.net/>
> > > > > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> > > > > For additional commands, e-mail: php-dev-help@lists.php.net
> > > > > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
> >
Mark Britton
brittmd@excite.com
---
No matter where you go, there you are.
_______________________________________________________
Get your free, private email at http://mail.excite.com/