简体   繁体   中英

php function execute - connection between php and C++ serverbased

I am currently working on a project, where I have to build a webpage, where I get some Data from the User and than convert that to a tree.

To make it run faster, I call a selfwrote C++ programm from php, where I sent all the needed Informations with JSON.

On Laptop I have Apache installed and on the localhost everything is working fine.

Now I moved all the files on the server and it doesn't work anymore. I think it has to do something with the connection between php and the C++ execute.

Has someone an Idea how I can test this clearly, to get where the mistake is? Because the function to call the C++ program seems to be enabled on the server.

The code where I call the C++ programm:

$mode = $_POST['mode'];
$val = "";
if ($mode == "f") {
 $sequenceList = $_POST['sequenceList'];
 $family = $_POST['family'];

 if ($sequenceList == "") {
  echo "error - no Sequences Added";
 } else if ($family == "") {
  echo "error - no Family Added";
 } else {
  exec("TreeDom.exe {$mode} {$sequenceList} {$family}", $output;

  foreach($output as $line) {
   $val=$line;
  }

  echo $val;
 } 
}

Thank you!

If your server is in a shared hosting (generic low-cost domain solution), the exec function may not work due to PHP safe mode. Take a look at this question for more insights.

It can be also a permission issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM