--
Ryan Dagey [mobile]
On Jan 30, 2013, at 2:19 PM, Allin Cottrell <cottrell(a)wfu.edu> wrote:
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
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
Thanks for the reply. We are simply running gretlcli from within php which should execute
as apache user. Now this user has no home directory, so if that causes gretlcli to default
to root directory, I don't know the inner workings of gretlcli. We are not doing
anything regarding the root user.
Why is gretlcli requiring any user directories at all? I don't understand what is
derived from these directories. It would be good if this is the case to review some
documentation on the required directories, I did a lot of googling looking for them.
Am I understanding that all of those environment variables have to be set every time in
PHP to some temporary directory just to get gretlcli to run in PHP under the apache user?
There is no way to tell gretlcli to use some set of defaults? I would think calling the
gretlcli directly would imply not wanting to use user preferences, especially when running
batch that the docs say are designed for programmed usage. How would the gretl home change
based on user pref anyway?
I checked my home directory that I tested the gretl commands and there is no .gretl2rc.
Would it be somewhere else?
I will run a test with the environment variables you specify.
Did this change from a prior version? Maybe we could get that version installed if this
does not help.