i am using wamp server in windows.......i used exec and system funtion ...... i used syntax like
<?php
exec('g++ filename.cpp' , $result);
echo $result;
?>
but don't get any result..........wat is problem there ?....... space between g++ and filename is a problem??.......... and wat other solution willbe possible for excute cpp file ??..........
hw can i execute c++ file using php ??.............
Moderator: General Moderators
hw can i execute c++ file using php ??.............
Last edited by koolsunny on Tue Apr 08, 2008 12:59 am, edited 1 time in total.
Re: hw can i execute c++ file using php ??.............
You have to make sure that g++.exe is in the PATH of the user that executes the php script
Re: hw can i execute c++ file using php ??.............
ya i used correct path but din't get solution ..........can u give me code hint .??......i am trying this from last 2-3 days but don't succeed.........timvw wrote:You have to make sure that g++.exe is in the PATH of the user that executes the php script
i am working on a project like a topcoder arena or spoj........where i need to compile solution that is submitted by user(thats will be a cpp file )....... so i need that type of soltion........
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: hw can i execute c++ file using php ??.............
Your host may not allow command line execution. Is it also possible that your code is failing to compile because it needs to know some lib and include paths?
Re: hw can i execute c++ file using php ??.............
In php code what library needed.??.....i used exec and system funtion ......syntax like thisChris Corbyn wrote:Your host may not allow command line execution. Is it also possible that your code is failing to compile because it needs to know some lib and include paths?
<?php
exec('g++ filename.cpp' , $result);
echo $result;
?>
i also secify path of file directory ..........but not succeed........ can u give me some code hint ........??