[GRASS-dev] running d.mon outside grass shell with php & granting rights problem

Glynn Clements glynn at gclements.plus.com
Thu May 11 19:10:09 EDT 2006


Paulick Consult wrote:

> when running d.mon out of a php script, I see 
> 
> d.mon start=PNG:
> /usr/local/grass-6.1.cvs/driver/PNG: error while loading shared libraries: 
> libgrass_driver.so: cannot open shared object file: No such file or 
> directory 
> 
> Inside the grass shell, it works fine. The environment variables for PATH 
> and GRASS_LD_LIBRARY_PATH are pointing at the right locations (from my point 
> of view; the requested files ar there and accessible). I nicked the php code 
> from Markus'  grass.itc.it/spearfish example. 

You need to set LD_LIBRARY_PATH. GRASS_LD_LIBRARY_PATH is merely a
saved copy so that the value can be restored if LD_LIBRARY_PATH is
reset due to running a setuid/setgid executable (e.g. xterm). 
LD_LIBRARY_PATH is what the Linux loader actually uses to locate
shared libraries.

> Second thing:
> I can't get outside-shell-access to a mapset even when calling in advance 
> g.access with grant for both user and group. When chowning the entire 
> location directory to user www-data, it works, but then there is no longer 
> access from the grass shell. 

You can't select a mapset as the current mapset unless you actually
own it. Having write permission isn't sufficient.

This check is implemented in G__mapset_permissions() and
G__mapset_permissions2() in lib/gis/mapset_msc.c. You will have to
modify those functions to disable the check if you want to be able to
modify mapsets which you don't own.

If your web application only reads the data, you can create a single
mapset directory owned by the account under which the PHP script runs,
then either use g.mapsets or explicit map at mapset references to access
maps in other mapsets.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list