DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   executing c++ code from php (http://www.daniweb.com/forums/thread65018.html)

jethroalias97 Dec 15th, 2006 8:53 pm
executing c++ code from php
 
hi, i'm trying to execute some c++ code from the php script in my webpage, but its not working. the best i could find was the php code below.

$output = shell_exec('ls -lart program.exe');
echo "<pre>$output</pre>";

here is the code of program.exe (codewarrior created program.exe from this code)

using namespace std;
int main()
{
    return 7;
}

when i run this the screen just says some data, like date and my host server and the program, but does not exectute the program.

i was trying to get it such that when i run the page this php script is on it says 7. thanks.

Puckdropper Dec 16th, 2006 6:20 pm
Re: executing c++ code from php
 
Are you sure your permissions allow remote execution? It's generally a Bad Idea (tm).

jethroalias97 Dec 16th, 2006 6:28 pm
Re: executing c++ code from php
 
no, i suppose i don't have permision, do you know if there is anyway to execute java code from a javascript or some other scripting language, i've been searching all over the interenet, but nothing seems to allow me to call java functions from the site's code.

Is this even possible?

Puckdropper Dec 17th, 2006 2:12 am
Re: executing c++ code from php
 
Your PHP code would simply output the HTML code necessary to load the Java Applet.


All times are GMT -4. The time now is 9:22 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC