Score:0

shell script cannot run in web php

jp flag

I try to run a shell script in my .php web page. The shell script works fine when i directly run it in terminal. But it gives no response in the web page. I can't even know whether there is an error or not.

Here is the code of my shell script:

#!/bin/bash
cd /home/user/Downloads
chmod a+x 123.AppImage
./123.AppImage freecadcmd "/path/to/my/python/abc.py"

And the python script is about putting some dimension in the existing FCStd file and exporting a WebGL.html.

And Here is the code of my .php page:

<?php
shell_exec ("/opt/lampp/htdocs/try.sh");
?>

<a href="localhost:333/dimension.html">link text</a>

I would like to see the dimension that is from the form of my web page.

And I have checked that there is nothing in the disable_function in php.ini. Can anyone tell me whats is the problem with my web page?

Thanks in advance.

uz flag
Jos
Is there anything in your web server logs?
terdon avatar
cn flag
What response would you expect? Also, note that the script will be executed by whatever user you have set up to run the webserver. Does that user have access to `/home/user/Downloads`? Oh, and by the way, you don't need to `cd`, you could just do `chmod a+x /home/user/Downloads/123.AppImage; /home/user/Downloads/123.AppImage`. But the main issue is probably that you don't have access to that. We can't know without more details about your setup.
Kabi2321 avatar
jp flag
I would like to see the dimension that is type in by myself on my previous web page. I expect to see the WebGL.html to show me the object with new dimension. The freecadcmd will run the python for me and generate the object with new dimension.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.