NB: oh yeah, the specs: PHP 5.5.9-1ubuntu4.4 Server version: Apache/2.4.7 Ubuntu 14.04-4
OK, this is driving me completely nuts.
Yes, the first problem is, I'm modifying someone else' code, so I'm trying to cludge this, but I don't have the time resources to write the entire application, at least not at this prototype stage.
That said, start_exec() works wonderfully in a standalone, test script, so there's nothing wrong with the server or php mods / version.
The scenario, on clicking an href or button, I want a script to run (it loads files from a remote sftp and also wgets from another server). One would think this isn't much of a problem, so here's where it becomes crazy making.
The code I'm working with is generating the html with print() in the form of print "<html>";
I've tried the usual examples for doing this function, but none of them are using embedded php in embedded html.
So this:
print"<tr><td class=leftsub><div width=100% class=info id=tasks>
<a href='windows.php?pull=true'><img src=images/explore.gif width=16 height=16> <u>Pull files from server</u></a><br>
does not invoke this:
if ($_GET['pull']) {
# This code will run if ?pull=true is set.
shell_exec('pull.sh');
}
Which is all in the local function.
And this doesn't work either:
print "<img src=images/extract.gif onClick='shell_exec('./pull.sh')' class=button title='Pull files'>";
Nor does this:
print ("<form method='post'><p><button name='button'>Run Perl</button></p></form>");
seem to call this:
if (isset($_POST['button'])) shell_exec('./pull.sh');
There are other ways I could perform the same, even just a cron that pulls and pushes on some regular interval, of couse which is checking to see if the files are open before pulling or pushing, but I'd rather it be on demand.
Am I just going to drive myself nuts without re-writing the entire code? Should I rather just have the requests call a different php script which then inline shell_exec()'s the shell script?
Any insight and feedback is very much appreciated.
Cheers,
Kevin