Page 1 of 1

How to use exec to execute external compile C++ program

Posted: Sun Aug 31, 2008 7:15 am
by mhant
I hope someone can help me. I am a C++ programmer and I created a program to run on a client's server and all I need is to run this program and it will create a pre-formated .html file for the client. I am trying to use the exec() command in php to run the program. Here is the code I have but can not seem to get it to work, any help would be much appreciated. All I want the code to do is run the extrenal program on my virtual server (for testing and then on the actual server)

<html>
<body>
<?php
//program is in same directory as .php file
exec('./logger.3')
?>
</body>
</html>

Re: How to use exec to execute external compile C++ program

Posted: Sun Aug 31, 2008 9:53 am
by marcth
What happens when you run "logger.3" from the command line?

What does this output?

Code: Select all

 
print exec('logger.3', $output, $returnValue) ? 'Success: ' : 'Failure: ';
 
print '*' . $returnValue . '*');
print '<pre>';
print_r($output);
print '</pre>';
 
Is it possible there are permission problems preventing PHP from executing the code? Are you running Unix/Linux or Windows?