Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP MapScript ignores PROJ_LIB environment variable #4930

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

PHP MapScript ignores PROJ_LIB environment variable #4930

fredmorin opened this issue May 22, 2014 · 2 comments

Comments

@fredmorin
Copy link

@fredmorin fredmorin commented May 22, 2014

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
Copy link
Author

@fredmorin fredmorin commented 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));

@tbonfort
Copy link
Member

@tbonfort 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.