PHP MapScript ignores PROJ_LIB environment variable #4930

Closed
fredmorin opened this Issue May 22, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@fredmorin

Loading a MapFile with PHP MapScript ignores Apache SetEnv PROJ_LIB value.

$map = new MapObj($file);
The MapObject has a setconfigoption method, unfortunatly it cannot be called before the constructor.

A solution would be to add a loadMapFile method to the MapObj which would allow to

$map = new MapObj();
$projLib = getenv("PROJ_LIB");
$map.setConfigOption("PROJ_LIB", $projLib);
$map.loadMapFile($file);

@fredmorin

This comment has been minimized.

Show comment
Hide comment
@fredmorin

fredmorin May 22, 2014

I found some kind of workaround using the old method ms_newMapObjFromString:

$projLib = getenv("PROJ_LIB");
$mapFileContent = $this->file_get_contents($file);
$mapFileContent = str_replace("MAP\r\n", "MAP\r\nCONFIG PROJ_LIB {$projLib}\r\n", $mapFileContent);
$map = ms_newMapObjFromString($mapFileContent, dirname($file));

I found some kind of workaround using the old method ms_newMapObjFromString:

$projLib = getenv("PROJ_LIB");
$mapFileContent = $this->file_get_contents($file);
$mapFileContent = str_replace("MAP\r\n", "MAP\r\nCONFIG PROJ_LIB {$projLib}\r\n", $mapFileContent);
$map = ms_newMapObjFromString($mapFileContent, dirname($file));

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Feb 11, 2015

Member

applied with #5057 in e17e69b

Member

tbonfort commented Feb 11, 2015

applied with #5057 in e17e69b

@tbonfort tbonfort closed this Feb 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment