[gdal-dev] Can not run ogr2ogr from a web server running PHP

Peter Hopfgartner peter.hopfgartner at r3-gis.com
Tue Dec 21 09:51:41 EST 2010


I'm trying to run ogr2ogr from a PHP script. This runs fine, if the script is run from the command line. It does not work if run through the web server.

The scripts basically runs:

/usr/local/bin/ogr2ogr -f 'ESRI Shapefile' '/tmp/tmp_plant_cfa4f818c6c5c1e7881b' 'OCI:plantmap/plantmapx at plantmap' -sql 'SELECT * FROM tmp_plant_cfa4f818c6c5c1e7881b' -nln plant

and returns the error:
ERROR 1: ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
 in <unnamed>

ORACLE_HOME, ORACLE_SID, ORACLE_HOME are set in the web server init script (the whole application runs with Oracle).
I tried to enforce the variables in the virtual host fragment in httpd.conf:
    SetEnv ORACLE_HOME /u01/app/oracle/product/11.1.0/db_1
    SetEnv ORACLE_SID plantmap
    SetEnv ORACLE_OWNER oracle

If I run a little test script, like:
#!/bin/sh
echo $ORACLE_HOME
echo $ORACLE_SID
echo $LD_LIBRARY_PATH

the environment variables are set correctly.
So why can't ogr2ogr find the correct Oracle instance?

Platform: RHEL 5, 64 bit, Oracle 11.1

Regards,

Peter Hopfgartner
 
R3 GIS Srl - GmbH
http://www.r3-gis.com




More information about the gdal-dev mailing list