Jump to content
php.lv forumi

Oracle + PHP


virtualcook

Recommended Posts

No kurienes konnects tiek taisiits?

Vai no Windows? Vai linux?

 

Jaanjem veeraa ka php uz servera (vai arii ja taa ir tava lokaalaa darbstacija) vajag Oracle clientu (gan uz linux, gan windows) un ar extensijas eneibloshana kaa tas ir mysql tikai nepietiek.

 

Klientam jaabuut nokonfigureetam t.i. ieksh tnsnames.ora jaabuut ierakstiitam attieciigajam serverim. Piemeeram

 

SOMESERVER.LV =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS =

(PROTOCOL = TCP)

(Host = 10.10.10.1)

(Port = 1527)

)

)

(CONNECT_DATA = (SID = SERVERIS)

)

)

 

 

 

Ja tas ir linux tad apaches profilaa ir jaabuut veel dazhaadiem envirounment parametriem (parasti var ielikt ieksh apachctl startup scripta) piem:

 

export ORACLE_HOME=/usr/oracle/ora817

export ORACLE_TERM=$TERM

 

export NLS_LANG=Latvian_Latvia.BLT8CP921

export ORA_NLS=$ORACLE_HOME/ocommon/nls/admin/data

export ORA_NLS32=$ORA_NLS

export ORA_NLS33=$ORA_NLS

 

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib:/usr/lib

export LIBPATH=$ORACLE_HOME/lib

 

export TMPDIR=/tmp

export TNS_ADMIN=/etc

 

PATH=$PATH:/usr/java/jdk118_v3/bin:$ORACLE_HOME/bin

export PATH

 

unset USERNAME

unset TWO_TASK

 

 

Konekteejoties no windozes parasti der kaut kas shaads:

 

<?

putenv("ORACLE_HOME=c:/orant");

$or=ora_logon("useris@(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERIS)(PORT = 1525))

(CONNECT_DATA = (SID = SERVERASIDS)))","parole");

?>

 

kur ORACLE_HOME ir oracle klienta atrashanaas vieta.

useris - userneims

SERVERIS - servera hosts vai IP

SERVERASIDS - Oracle sids

parole - pati par sevi :)

Link to comment
Share on other sites

  • 3 weeks later...

... pigori bija tādi, ka nebija eneiblots extension=php_oracle.dll php.ini failaa :-))

 

... bet man vēl tāds jautājums, kāpēc ar šo te garo pierakstu pierakstu var iekonektēties

 

<?

$or=ora_logon("useris@(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERIS)(PORT = 1525))

(CONNECT_DATA = (SID = SERVERASIDS)))","parole");

?>

 

bet ar šo te īso ne?

 

<?

$or=ora_logon("useris@TNSNAME","parole");

?>

Link to comment
Share on other sites

Iespeejams ka vinsh (klients) kaut kaa nekorekti vai vispaar nenolasa tnsnames.ora ar attieciigaa servera aprakstiem (neesmu mekleejis ceelonjus / iemeslus).

Tas gan taa ir tikai uz windows platformas, uz *ix straadaa korekti arii vienkaarshais ora_logon("useris@TNSNAME","parole"); variants.

Link to comment
Share on other sites

×
×
  • Create New...