Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Apache2 + Perl + Oracle
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 11:08 am    Post subject: [solved] Apache2 + Perl + Oracle Reply with quote

Hallo Leute,

ich habe mal wieder ein Problem mit Oracle, Perl und dem Apache2. Ich kann ein perl-Skript auf der Konsole starten und die Verbindung zur Datenbank wird aufgebaut.Wenn ich jetzt jedoch versuche, das Skript im Webserver zu starten,bekomme ich immer folgenden Fehler:

ERROR OCIEnvNlsCreate (check ORACLE_HOME and NLS settings etc.)

Ich habe auch schon gegooglet, aber leider keine Lösung gefunden.

Ich habe auch schon diesen Fehler gehabt:

TNS:could not resolve the connect identifier specified

Ich habe das Problem nur bei perl, wenn ich das mit php mache habe ich keine Schwierigkeiten.

Hat jemand eine Idee?

Gruß Hunter


Last edited by hunter1977 on Mon Oct 03, 2005 1:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sas
Veteran
Veteran


Joined: 05 Jul 2003
Posts: 1229
Location: Germany

PostPosted: Mon Oct 03, 2005 11:19 am    Post subject: Reply with quote

Schreib doch mal n kleines Perl-Skript, dass das Ora-Homedir ausgibt. Und guck, obs stimmt, wenn dus via apache ausführst.
_________________
42
Back to top
View user's profile Send private message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 11:30 am    Post subject: Reply with quote

Das habe ich mit php schon gemacht. Und es stimmt!
Back to top
View user's profile Send private message
Sas
Veteran
Veteran


Joined: 05 Jul 2003
Posts: 1229
Location: Germany

PostPosted: Mon Oct 03, 2005 11:50 am    Post subject: Reply with quote

PHP-Skripte werden (ich glaube je nach Konfiguration) aber von einem anderen Benutzer ausgeführt als CGI-Aufrufe.
_________________
42
Back to top
View user's profile Send private message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 11:55 am    Post subject: Reply with quote

Ach so, tja leider kenne ich mich mit Perl gar nicht aus.

Hast du dafür ein Tutorial zur Hand?

Oder wie mache ich das am besten?

Gruß Hunter
Back to top
View user's profile Send private message
Sas
Veteran
Veteran


Joined: 05 Jul 2003
Posts: 1229
Location: Germany

PostPosted: Mon Oct 03, 2005 12:03 pm    Post subject: Reply with quote

Alles, was ich bislang in meinem Leben an Perl geschrieben habe, passt locker auf eine Bildschirmseite. Von daher: Nö.

Ich dachte, du bist derjenige, der Perl einsetzt.

Aber so in der Art sollte es gehen:
Code:

#!/usr/bin/perl

use strict;

my $cmd = "whoami";

print "Content-type: text/plain\n\n";

my $output = "";
$output .= `$cmd`;

print $output;

_________________
42
Back to top
View user's profile Send private message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 12:46 pm    Post subject: Reply with quote

Nein, ich nutze kein perl, das macht ein Kollege und der arbeitet mit einer WIN Maschine und die will ich endlich ablösen.

Ich versuche gerade die Perl-Skripte zu migrieren, aber ich denke, dass ich mir wohl perl ansehen muss.

Danke für die Hilfe erstmal.

Hunter
Back to top
View user's profile Send private message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 12:54 pm    Post subject: Reply with quote

Gute Idee, ich sehe gerade das für das Perl gar keine ORALE_HOME oder TNS_ADMIN gesetzt ist.

Wie könnte ich das denn machen?
Back to top
View user's profile Send private message
Sas
Veteran
Veteran


Joined: 05 Jul 2003
Posts: 1229
Location: Germany

PostPosted: Mon Oct 03, 2005 1:03 pm    Post subject: Reply with quote

Hmm, von welcherm User werden denn die Perl-Skripte ausgeführt?

Und wie hast dus PHP beigebracht?

Im Zweifelsfall könntest du die Umgebungsvariable natürlich auch systemweit setzen.
_________________
42
Back to top
View user's profile Send private message
hunter1977
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 297

PostPosted: Mon Oct 03, 2005 1:07 pm    Post subject: Reply with quote

So, habe gerade die Lösung gefunden.

<Directory "/var/www/localhost/cgi-bin/">
AllowOverride None
Options None
Order allow,deny
Allow from all

SetEnv ORACLE_BASE /opt/oracle
SetEnv ORACLE_HOME /opt/oracle/product/10.1.0.3
SetEnv ORACLE_SID "XXX"
SetEnv ORACLE_TERM xterm
SetEnv ORACLE_OWNER oracle
SetEnv TNS_ADMIN /opt/oracle/product/10.1.0.3/network/admin
#SetEnv NLS_LANG AMERICAN_AMERICAN.WE8ISO8859P1
SetEnv ORA_NLS10 /opt/oracle/product/10.1.0.3/nls/data
SetEnv CLASSPATH /opt/oracle/product/10.1.0.3/jdbc/lib/classes12.zip
SetEnv LD_LIBRARY_PATH /opt/oracle/product/10.1.0.3/lib:/opt/oracle/product/10.1.0.3/lib32
SetEnv DISABLE_HUGETLBFS 1
</Directory>

Mit SetEnv können Umgebungsvariablen gesetzt werden und dann klappt es auch mit Perl :-).
Danke und Gruß Hunter
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum