Jump to content

C program seg faults when called in php script


Recommended Posts

I'm trying to call a program (hbplus) from the command line. 

When I run the program directly from the command line, it executes successfully.  When I run the program using the script below, I get a segmentation fault.  Any ideas why?

 

 

<?php

echo '<pre>';

$last_line = system('./hbplus', $retval);

// Printing additional info

echo '

</pre>

<hr />Last line of the output: ' . $last_line . '

<hr />Return value: ' . $retval;

?>

 

I added to code to my script so that the console output was saved, and I got the following output:

 

-bash-4.0$ cat hboutput

./hbplus: /lib/libc.so.6: version `GLIBC_2.7' not found (required by ./hbplus)

 

When I run my program from the command line as shown, it executes succesfully.

-bash-4.0$ ./hbplus 1PEF.pdb

 

My php script:

 

<?php

echo '<pre>';

// Outputs all the result of shellcommand "ls", and returns

// the last output line into $last_line. Stores the return value

// of the shell command in $retval.

$last_line = system('./hbplus 1PEF.pdb &>hboutput', $retval);

 

// Printing additional info

echo '

</pre>

<hr />Last line of the output: ' . $last_line . '

<hr />Return value: ' . $retval;

?>

 

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.