[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave 3.8.0 and PHP
From: |
eykiriku |
Subject: |
Re: Octave 3.8.0 and PHP |
Date: |
Wed, 5 Feb 2014 03:44:21 -0800 (PST) |
FROM PHP:
The command passed to shell_exec for example
$cmd = "octave3.8 -q --eval 'cd '/path/to/file/';Myfile;' 2>&1 ";
is executed properly but the print function (inside Myfile.m), still not
work. I got the same errors like the previous post...error: fputs: invalid
stream number = -1 etc....
The same call from the terminal works properly till the end, hence a plot
pops up and then an image called plot.png is correctly saved to the desired
path.
Regarding your suggestion of using the saveas command. Whenever I add the
saveas command the output is:
parse error: syntax error >>> /path/to/file/....
In my case I need also need to pass a parameter (a string) to the Myfile,
and whenever I use the --eval option the error arises again.
The command I executed are here below.
SAVEAS CASE:
$cmd = "octave3.8 -q --eval 'cd '/path/to/file/'; Myfile; saveas(1,
'/save/path/plot.png')' 2>&1 ";
PASSING AN ARGUMENT CASE:
$cmd = "octave3.8 -q --eval 'cd '/path/to/file/'; Myfile
/path/to/file/arg_file.txt' 2>&1 ";
or
$cmd = "octave3.8 -q --eval 'cd '/path/to/file/';
Myfile('/path/to/file/arg_file.txt')' 2>&1 ";
or
passing a variable containing the string :'/path/to/file/arg_file.txt'
All this could be solved if I am able to make PHP execute the same commands
I can execute from the terminal. And so avoiding the --eval function or (of
course understanding what the syntax error is).
Since the commands run fine from the terminal (as root), I am guessing that
could be that PHP doesn't have the privileges to open a plot from Octave and
save the figure to a folder (the user I use in PHP has root privileges).
Could it be?
Thanks in advance
--
View this message in context:
http://octave.1599824.n4.nabble.com/Octave-3-8-0-and-PHP-tp4661495p4661650.html
Sent from the Octave - General mailing list archive at Nabble.com.