-----Original Message-----
From: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-
bounces(a)lists.wfu.edu] On Behalf Of Allin Cottrell
Sent: Wednesday, January 30, 2013 4:07 PM
To: Gretl list
Subject: Re: [Gretl-users] gretlcli & PHP
On Wed, 30 Jan 2013, Ryan Dagey wrote:
> Is there a way to pass config data to gretl on the command line?
At present all the things you can do on the initial command line are
exposed
by "gretlcli --help", and the list doesn't include
passing config data.
I'll experiment with running gretlcli under Apache myself and see what we
can come up with in terms of making this easier.
Allin Cottrell
[>]
I did some more testing. First, setting up the GRETL_HOME env var made no
change in the result, but I have some more info to go on.
I did get gretl to show me all the output, and the strange thing is that
it's exactly as it should be. I don't understand the entries in the
php_error_log about "gretldir is maybe...", but the gretlcli output is
exactly the same as when run in a normal shell. However, the result file is
never created, despite the output being correct. I'm attaching below the
sample output that shows the environment variables I set via PHP putenv call
and the output of the gretlcli call. The calculations seem sound, the only
issue is that the result file is not created. I've changed over the working
directory (which I already tested with full permissions) to the /tmp
directory, so we can rule out a permissions issue. It's almost like gretl
simply cannot write to any file, though it appears to be trying. Any
thoughts on what we are doing wrong would be greatly appreciated.
Below is the output (first lines are getenv PHP calls to confirm env var
setup, the last line is the return variable of the gretlcli call from the
exec function parameter). The problem is that the file
/tmp/resultsFile74270470 is never created. Also I tested without the call
to output to this file, and the entries in the PHP error log still appear
regardless.
I did notice that the .gretl/gretl directories in the temporary apache home
directory have an updated timestamp from when I copied them over yesterday.
That tells me that gretl is accessing these directories, so that seems to be
working as intended. Yet we still get the entries in the PHP log and the
result file is not created. Maybe someone can shed some light on this
behavior?
Below the browser output, I show the permissions on /tmp and /tmp/apache
(including contents of the latter).
BROWSER OUTPUT:
HOME: /tmp/apache/
GRETL_HOME: /usr/share/gretl/
**** gretl output ****
gretl output: gretl version 1.9.11
Copyright Ramu Ramanathan, Allin Cottrell and Riccardo "Jack" Lucchetti
This is free software with ABSOLUTELY NO WARRANTY
Current session: 2013-01-30 20:37
? run /tmp/commandFile74270470
/tmp/commandFile74270470
? open /tmp/dataFile74270470.csv
parsing /tmp/dataFile74270470.csv...
using delimiter ','
longest line: 21 characters
first field: 'pHours'
number of columns = 2
number of variables: 2
number of non-blank lines: 112
scanning for variable names...
line: pHours,period
scanning for row labels and data...
treating these as undated data
Listing 3 variables:
0) const 1) pHours 2) period
? ols pHours const period
Model 1: OLS, using observations 1-111
Dependent variable: pHours
coefficient std. error t-ratio p-value
--------------------------------------------------------
const 4.16542 0.0781421 53.31 6.62e-80 ***
period -0.00365263 0.00122763 -2.975 0.0036 ***
Mean dependent var 3.964522 S.D. dependent var 0.428961
Sum squared resid 18.72043 S.E. of regression 0.414424
R-squared 0.075117 Adjusted R-squared 0.066631
F(1, 109) 8.852685 P-value(F) 0.003605
Log-likelihood -58.71691 Akaike criterion 121.4338
Schwarz criterion 126.8529 Hannan-Quinn 123.6322
? outfile /tmp/resultsFile74270470 --append
Now appending output to '/tmp/resultsFile74270470'
Closed output file '/tmp/resultsFile74270470'
? exit
Done
**** end gretl output ****
returrned: 1
Here are the permissions on /tmp:
# ls -la /tmp/
total 184
drwxrwxrwt 5 apache apache 143360 Jan
30 20:38 .
drwxr-xr-x 22 root root 4096
Jan 30 20:00 ..
Here is the structure of the /tmp/apache to show we copied the home dir
files from a working user:
# ls -la /tmp/apache/
total 156
drwxrwxrwx 4 apache apache 4096 Jan 29 21:29 .
drwxrwxrwt 5 apache apache 143360 Jan 30 20:47 ..
drwxrwxrwx 5 apache apache 4096 Jan 30 20:37 .gretl
drwxrwxrwx 2 apache apache 4096 Jan 30 20:37 gretl
--
Ryan Dagey