On Tue, 29 Jan 2013, Ryan Dagey wrote:
We had a version of gretl running in our PHP application but it
stopped
working after a fresh install (and an upgrade most likely). We've worked
out some issues with the command reference and can get everything to work
using gretlcli from a shell, but the same commands run from within PHP fail.
We cannot figure out what the error is. In the PHP output, all we see is
this:
gretl is process 10625, '/usr/bin/gretlcli'
gretldir is maybe '/usr/share/gretl/'?
You should maybe be using the environment variable GRETL_HOME
to tell gretl where various things it needs are located. If
gretl is installed under /usr:
GRETL_HOME="/usr/share/gretl"
if it's under /usr/local
GRETL_HOME="/usr/local/share/gretl"
and so on.
There should be a results file created per the code, which works
when
running in the shell. However when running from PHP, the results file is
never created. I believe there is some problem with the environment. We
had to setup a HOME environment variable for the apache user because we kept
getting permission denied errors from gretl trying to access "/root/.gretl"
and "/root/gretl".
So gretl is being run as the root user? That's probably not
not a good policy.
Anyway, I've just now modified the gretl source in CVS to
add support for a couple of environment variables that should
help in this sort of situation:
GRETL_DOTDIR : the gretl "dot directory", by default
$HOME/.gretl for the user in whose name gretl is running,
on unix-type systems.
GRETL_CONFIG_FILE : the name of the per-user configuration
file, by default $HOME/.gretl2rc on unix-type systems.
Once you have GRETL_CONFIG_FILE set, you can create a file in
a suitable location that sets various gretl parameters. See
~/.gretl2rc in a "normal" gretl installation for an example.
Allin Cottrell