Hello. I'm trying to write a simple php frontend for a jython program. Here is the php file:
<?php
$cmd = 'jython interactiveNER.py';
$html = `$cmd`;
echo $html;
?>
The problem is that the jython script takes about ten seconds to run and the php script isn't waiting for it to finish and simply returns a blank page.
I've verified that the command I'm giving it runs from the shell. What do I need to do to get php to wait?
Thanks,
Joshua.
PHP Not waiting for script to finish.
Moderator: General Moderators
Re: PHP Not waiting for script to finish.
have you tried sleep():
Code: Select all
$cmd = 'jython interactiveNER.py';
sleep(10);
$html = `$cmd`;
echo $html;
Re: PHP Not waiting for script to finish.
I tried sleep() with a value up to a minute (it doesn't take that long for the script to run) and the results were negative.
I modified the script so that it would make a file on the directory when run to make sure it was actually being run. The file wasn't created, so it doesn't appear to even be running. Hm.
Is exec somehow limited in what it can run? What else could be the problem?
Thanks,
Joshua.
I modified the script so that it would make a file on the directory when run to make sure it was actually being run. The file wasn't created, so it doesn't appear to even be running. Hm.
Is exec somehow limited in what it can run? What else could be the problem?
Thanks,
Joshua.
Re: PHP Not waiting for script to finish.
It turned out that jython was expecting a $HOME environment variable and couldn't find it. I added that to the command and it runs as expected. Thanks for your help, Weiry.
Joshua.
Joshua.