Execute c/c++ file using php script...??....
Moderator: General Moderators
Execute c/c++ file using php script...??....
hi..... i am using lampp server in red hat Linux .....I used system and exec command to execute c/c++ file .......but didn't get any result.....please suggest ideas ..... same problem i faced at windows wamp server( script are running but not getting any result) .......
Re: Execute c/c++ file using php script...??....
http://www.php.net/shell_exec
You must give the correct directory
And for heavens sake dont forget case sensitivity
You must give the correct directory
Code: Select all
<?php
shell_exec('sh /home/anto/application');
?>
Re: Execute c/c++ file using php script...??....
what if the file is in same directory...anto91 wrote:http://www.php.net/shell_exec
You must give the correct directory
And for heavens sake dont forget case sensitivityCode: Select all
<?php shell_exec('sh /home/anto/application'); ?>
i used
Code: Select all
<?php
shell_exec('c++ 1.cpp');
?>
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Execute c/c++ file using php script...??....
No, you need to specify the fullpath, not the relative path.
Re: Execute c/c++ file using php script...??....
In order to execute a "c++ file" you need to:
1. Compile it
2. Run the resulting executable
1. Compile it
2. Run the resulting executable