Compile C program using PHP-5
To day i successfully compile a .c program using PHP-5. It just simple.I just use “System()” function on PHP-5.
To day i successfully compile a .c program using PHP-5. It just simple.I just use “System()” function on PHP-5.
Theme: Paperpunch by The Theme Foundry. Blog at WordPress.com.
how did u compiled…. plz tell me how??
i used system(“cc sam.c”); but itz not working …
i compile it using system(“gcc main.c”); remember u have to make the directory permission ’0777′ .
shell_exec() function can also be called with command line arguments.
should give the same result as system()?
@php programmer
ya u r right
i want to run a c program via php. the program also has scanf commands. how do i give these inputs. i canntouse command line arguments as the inputs are to be given from dynamically collected data over the time.
how about u read the inputs form a file ?
i think that can help u .
I want to see all compiling error in php. How could it possible pls help me.
Thanks for this helpful post
u need to call an shell script for that in that shell script put the compile command and save the output of those command on another file then read the file and do what ever u want .
there maybe some easy way too.
i am making online compiler for college… i need to now when i assign text filed values to variable what i should put in system(gcc and then?) ? pls help its urgent
u have to filter the text before u pass that to the system, bcoz u need make sure that there is not harmful command , or u can lost ur server data
I tried shell_exec(‘gcc -0 Compile Compile’); , system(‘gcc -0 Compile Compile’);, exec(‘gcc -0 Compile Compile’); to run my C code but its not working.
You need to allow those functions on php.ini files , usually those are not allowed in shared hosting .
I could use the command for running ‘./compile’ but.
i’m trying to design an online compiler.. , i’m not able to run this command system(‘gcc hello.c) from my php file… ,but system(‘./a.out’) works
wud u plz send me the code i m in trble…
my emailid:rock389@yahoo.com
Hey Rock please check the phpinfo() for the exec, system etc functions most of the hosting dont allow to call those functions , you can try in your VPS or local server .
c & C++ Program code input textarea in PHP and out put in div any one do this work replay to me and send the php code