Re: [greenstone-users] How to get GSLHOME value in PHP

From graeme
DateSun, 28 Oct 2007 14:38:49 +1000
Subject Re: [greenstone-users] How to get GSLHOME value in PHP
In-Reply-To (4721526F-10602-dlconsulting-com)


Sorry, I've been busy of late, but hopefully this is still relevant. You should be able to access the details from within PHP using the $_ENV variable, try something like $path = $_ENV['GSDLHOME'];


On 10/26/07, Richard Managh <> wrote:
Hi Bertrand,

Bertrand SODJAHIN wrote:
Dear all !
I did this in PHP (For a linux server) : $path=shell_exec(@echo $GSDLHOME);
                           var_dump($path); // result is : string(1) " "
Do you think there is another way to get it ?


If you have greenstone setup on a linux server, the GSDLHOME variable doesn't exist, generally for apache, outside of when apache is running greenstone itself. So it is not possible to get the value of gsdlhome from PHP, unless you already know it, but then you wouldn't need to get it anyway.

I imagine it would exist for Apache if you opened a bash, and did

export GSDLHOME=some_path

and then started apache, in this case Apache would be started in an environment that knows about GSDLHOME. In turn PHP would presumably know about this environment variable, and you might be able to obtain gsdlhome with something similar to the PHP code you provided.



DL Consulting
Greenstone Digital Library and Digitisation Specialists

greenstone-users mailing list