Gutza / octave-daemon

The PHP network daemon for GNU Octave
http://projects.moongate.ro/octave-daemon/
GNU Affero General Public License v3.0
16 stars 2 forks source link

from php class #15

Open tims-corbett opened 8 years ago

tims-corbett commented 8 years ago

Hi,

I am running a vagrant box.

the following works fine: nohup octave-daemon -d -c /etc/octave-daemon.conf&

from the quick start examples, the following works great in /var/www/html/test.php without even starting the daemon: require "Octave_lib.php"; $octave=new Octave(false); echo "Result=".$octave->query("1+2");

however, the following fails: $octave=new Octave("127.0.0.1);

the same code fails when placed in a php class (symfony Controller). says Command did not run successfully on line "new Octave"

what are the fixes?

Gutza commented 8 years ago

The first issue is easy to fix – just replace the path in the script with whatever works for you. I didn't have the time and curiosity to make the init scripts truly portable. If you can find a way to make it work on most (all?) distros, by all means, do send in a patch.

Regarding the second issue, please include the error specifically. As it stands, you have an obvious syntax error in that line (you never close the hostname string), but I'm not sure that's exactly the code you're trying to run.

On 07/07/16 6:46 , tims wrote:

Hi,

I am running a vagrant box.

service octave-daemon start gives the following error: /etc/init.d/octave-daemon: line 14: /etc/rc.d/init.d/functions: No such file or directory Starting GNU Octave daemon (octave-daemon): /etc/init.d/octave-daemon: line 29: daemon: command not found

however, the following works fine: nohup octave-daemon -d -c /etc/octave-daemon.conf&

from the quick start examples, the following works great in /var/www/html/test.php without starting the daemon: require "Octave_lib.php"; $octave=new Octave(false); echo "Result=".$octave->query("1+2");

the following fails: $octave=new Octave("127.0.0.1);

the same code fails when placed in a php class (symfony Controller). says Command did not run successfully on line "new Octave"

what are the fixes?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Gutza/octave-daemon/issues/15, or mute the thread https://github.com/notifications/unsubscribe/AAjE12XPMxwlKqbrvss3fpdtpLfbMjkRks5qTHaxgaJpZM4JGtnU.

tims-corbett commented 8 years ago

Thanks for the response. Closing the string was only a typo here

require "absolute.path/Octave_lib.php"; $octave=new Octave("127.0.0.1"); echo "Result=".$octave->query("1+2");

Yields "Result=" Instead of "Result=3"

However new Octave (false) works perfect above.

Issue 2: require "absolute.path/Octave_lib.php"; class DefaultController extends Controller { /* * @Route("/", name="homepage") / public function indexAction(Request $request) { $octave=new Octave(false); }

results in "139 command did not run successfully

Gutza commented 8 years ago

Issue 1: did you successfully start the daemon before running that?

Issue 2: that looks like something idiosyncratic to your particular setup within that framework, and you should probably try to simplify the use case to a less esoteric class instead of Octave (perhaps a simple, home-brewed example).

On 07/07/16 15:34 , tims wrote:

Thanks for the response. Closing the string was only a typo here

require "absolute.path/Octave_lib.php"; $octave=new Octave("127.0.0.1"); echo "Result=".$octave->query("1+2");

Yields "Result=" Instead of "Result=3"

However new Octave (false) works perfect above.

Issue 2: require "absolute.path/Octave_lib.php"; class DefaultController extends Controller { /**

  • @Route https://github.com/Route("/", name="homepage") */ public function indexAction(Request $request) { $octave=new Octave(false); }

results in "139 command did not run successfully

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Gutza/octave-daemon/issues/15#issuecomment-231064605, or mute the thread https://github.com/notifications/unsubscribe/AAjE1w6CTMvs07GIKxVTPGK1VxLsUU1Nks5qTPJLgaJpZM4JGtnU.

tims-corbett commented 8 years ago

Issue 1 nohup octave-daemon -d -c /etc/octave-daemon.conf&

Seemed to have worked fine. How can I check it?

Issue 2 I would like to use the php symfony framework ( model view controller architecture) Utmost I can try moving the octave call to model file and try again

Gutza commented 8 years ago

Issue 1: don't nohup it – run it in a separate console and see what it does

Issue 2: I get that; I was suggesting a way to experiment with Symphony replacing the Octave class with a simpler class temporarily; maybe it's an issue with includes, or whatever else.

tims-corbett commented 8 years ago

Issue 1: root@vagrant-ubuntu-trusty-64:~# sudo octave-daemon -d -c /etc/octave-daemon.conf& [1] 11669 root@vagrant-ubuntu-trusty-64:~# PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Configuration error: Invalid group name in run_as (nobody)' in /usr/bin/octave-daemon:32 Stack trace:

0 {main}

thrown in /usr/bin/octave-daemon on line 32

Issue 2: will try and let you know

tims-corbett commented 8 years ago

Issue 2: SOLVED There is some suggestion here: http://stackoverflow.com/questions/38237651/octave-daemon-from-php-class-file/38251500#38251500

Worked after copying "classes" folder and saying "use Octave"