Oracle Treiber installieren

Oracle Instantclient installieren. Die Dateien liegen im Trunk unter dev/docker/egotec-sles-12sp3/tmp/.

zypper in unixODBC
zypper --no-gpg-checks in oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
zypper --no-gpg-checks in oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm

Anschließend die .so Dateien von dev/docker/egotec-sles-12sp3/usr/ nach /usr/lib64/php7/extensions/ kopieren.

Die Erweiterungen in PHP aktivieren.

echo "extension=oci8.so" > /etc/php7/conf.d/oci8.ini
echo "extension=pdo_sqlsrv.so" > /etc/php7/conf.d/pdo_sqlsrv.ini
echo "extension=sqlsrv.so" > /etc/php7/conf.d/sqlsrv.ini

tnsnames.ora in PHP für Oracle Verbindung einbauen

conf.ini anpassen:

[oci]
host=""
user="username"
password="password"
database="service"
log_select="0"
log_select_timeout="0.01"

Aufbau tnsnames

<span>serivce </span><span>=</span><span>(</span><span>DESCRIPTION </span><span>=</span><span>(</span><span>ADDRESS_LIST </span><span>=</span><span>(</span><span>ADDRESS </span><span>=</span><span>(</span><span>PROTOCOL </span><span>=</span><span> TCP</span><span>)(</span><span>HOST </span><span>=</span><span>*<</span><span>validhost</span><span>>*)(</span><span>PORT </span><span>=</span><span>*<</span><span>validport</span><span>>*))</span><span>)</span><span>(</span><span>CONNECT_DATA </span><span>=</span><span>(</span><span>SERVER </span><span>=</span><span> DEDICATED</span><span>)</span><span>(</span><span>SERVICE_NAME </span><span>=</span><span>*<</span><span>servicenamefromDB</span><span>>*)</span><span>)</span><span>)<br></span>

tnsnames.ora in PHP einbinden

putenv('ORACLE_HOME=/usr/lib/oracle/11.2/client64/');
putenv('TNS_ADMIN=/usr/lib/oracle/11.2/client64/');
putenv('LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib');

Wichtig!

Wenn der Client Installiert ist muss unter /usr/lib/oracle/$version/client64/network/admin die tnsnames.ora liegen. Ansonsten funktioniert die Verbindung nicht.