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

From Richard Managh
DateFri, 26 Oct 2007 15:35:27 +1300
Subject Re: [greenstone-users] How to get GSLHOME value in PHP
In-Reply-To (192415-50271-qm-web25802-mail-ukl-yahoo-com)
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