You are here: GSI Wiki>Linux Web>PHP (2007-09-28, DennisKlein)Edit Attach

PHP

mit PHP auf Oracle Datenbank zugreifen

Der Zugriff auf die Oracle Datenbank erfolgt über die OCI8 Schnittstelle (Dokumentation). Vorrausgesetzt ist ein installierter Oracle Client und korrekte Konfiguration des PHP Interpreters.

Die Datenbanknamen db und db-test werden vom TNS aufgelöst. Genau das scheint mit der OCI8 Schnittstelle in PHP unter bestimmten Umständen nicht zu funktionieren. Hier ein Workaround (für eine GSI-Linux-Maschine):
$oracle_db = 'db'; // oder "db-test"
// resolve oracle_db name "manually"
$oracle_db = exec(". oraenv && tnsping " . $oracle_db . " | grep 'Attempting to contact' | awk '{print \$4 \" \" \$5}'");
$oracle_db = implode(') (', explode(')(', $oracle_db));

-- DennisKlein - 20 Oct 2006

mit PHP auf GSI OID (LDAP Server) zugreifen

Der Zugriff auf das GSI OID (LDAP Server) erfolgt über die PHP LDAP Schnittstelle (Dokumentation). Vorrausgesetzt ist eine korrekte Konfiguration des PHP Interpreters.

Der prinzipielle Lesezugriff (per anonymous bind) ist:
$connection_id = ldap_connect($server, $port);
ldap_bind($connection_id);
$result = ldap_get_entries($connection_id, ldap_search($connection_id, $dn, $filter, $attributes));
ldap_close($connection_id);

Ein etwas komplexeres Beispiel, welches in Ihrem ~/web-docs/ Verzeichnis ausgeführt werden kann:

* ldap.php.txt: Beispielskript für "anonymous bind"-Lesezugriff auf GSI OID.

-- DennisKlein - 28 Sep 2007

I Attachment Action Size Date Who CommentSorted ascending
ldap.php.txttxt ldap.php.txt manage 3 K 2007-09-28 - 18:05 DennisKlein Beispielskript für "anonymous bind"-Lesezugriff auf GSI OID.
Topic revision: r2 - 2007-09-28, DennisKlein
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)