Reputation
479
Top tag
Next privilege 500 Rep.
Access review queues
Badges
2 8 16
Newest
 Commentator
Impact
~90k people reached

  • 0 posts edited
  • 0 helpful flags
  • 12 votes cast
Apr
23
accepted Operation not permitted
Apr
23
comment Operation not permitted
I am also aware of webMathematica of course, but that's not what I want to do. I came here to ask about why my solution is not working and I still don't have a full answer. There is something wrong with the permissions or something which is causing passthru to return an error message, and that's what I want to sort out.
Apr
23
comment Operation not permitted
I've told you that everything happens on my local machine. I have a local instance of apache running on my computer. From a technical perspective it should not matter if I ask apache to execute the file (by going to 127.0.0.1:8080/evaluateMMA/index.php in the browser) or if I execute it manually via the terminal (php -f index.php), yet the former does not work and the latter does work.
Apr
23
comment Operation not permitted
I have that part nailed down, I have several years of experience with building PHP applications. The problem is only that passthru throws error 1 as I have said, instead of returning the result (if you reread my previous comments it should now be clear what I am trying to do and what the problem is, all taken together.)
Apr
23
comment Operation not permitted
What I'm trying to do is build an interface in HTML with a form. I want to pass code through this form and I want the interpreted result to be shown in the HTML interface. All this will happen on my local machine. This is not working right now because passthru is returning 1 instead of the result, as it does when I execute the same file in the terminal.
Apr
23
comment Operation not permitted
I thought the shebang in the beginning of the file means that it is executable. It works your way if I call it from the terminal by php -f test.php - thank you! - however if I run it as a website on a local server then I get the error 1, which is a catch-all for all kinds of errors. So now I'm facing the problem of why it is working from the terminal but not in the browser. Could it be because the server is a different user, I'm told typically the server is 'www'?
Apr
23
awarded  Commentator
Apr
23
comment Operation not permitted
@taliezin This is the permissions it has: -rwxr-xrwx - I don't know much about permissions but that looks ok I think.
Apr
23
comment Operation not permitted
I have seen that, could you explain it to me? The parameter list reads: "command. The command that will be executed." ./mmascrip.m is a command that works in the terminal sometimes, but often not as I described in my question. It shouldn't have anything to do with passthru since I'm getting the same thing if I execute the file in the terminal, no PHP involved.
Apr
23
comment Operation not permitted
It returns "fopen complete.fwrite 1 complete.fwrite 2 complete.close complete.Permissions Successfully Changed.Passthru Complete.126" Also note that 126 is what passthru has assigned to $error, and passthru is not supposed to echo anything when it has thrown an error.
Apr
23
revised Operation not permitted
edited tags
Apr
23
comment Operation not permitted
@taliezin Yes sorry, I meant "when I change it in the PHP code"; it's when I did what you suggested and changed to './mmascript.m' in the PHP code that I get error 126. Same thing if I use the full path.
Apr
23
comment Operation not permitted
@taliezin From the command line that gives the error I've been talking about; in the PHP code it now gives a more understandable error, 126, "Command invoked cannot execute" which indicates "Permission problem or command is not an executable."
Apr
23
comment Operation not permitted
@datUser Both the PHP script and mmascript.m are in the same folder.
Apr
23
asked Operation not permitted
Dec
31
awarded  Notable Question
Nov
12
awarded  Popular Question
Sep
19
awarded  Famous Question
Aug
8
awarded  Nice Question
Jul
2
awarded  Curious