naomik Posted September 4, 2009 Share Posted September 4, 2009 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; ?> Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/ Share on other sites More sharing options...
corbin Posted September 4, 2009 Share Posted September 4, 2009 Do you happen to have the code of the C program? Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/#findComment-912726 Share on other sites More sharing options...
naomik Posted September 6, 2009 Author Share Posted September 6, 2009 I have it. It's not open source, but it's widely used. You have to write a professor to download it. http://www.biochem.ucl.ac.uk/bsm/hbplus/home.html Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/#findComment-913538 Share on other sites More sharing options...
naomik Posted September 6, 2009 Author Share Posted September 6, 2009 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; ?> Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/#findComment-913563 Share on other sites More sharing options...
naomik Posted September 30, 2009 Author Share Posted September 30, 2009 See http://www.phpfreaks.com/forums/index.php/topic,271012.0.html for resolution. Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/#findComment-927710 Share on other sites More sharing options...
Maq Posted September 30, 2009 Share Posted September 30, 2009 Please don't double post, it just wastes time. Link to comment https://forums.phpfreaks.com/topic/173163-c-program-seg-faults-when-called-in-php-script/#findComment-927717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.