Using PHP to compile uploaded sourcecode with cygwins gcc?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I have an intresting problem: I want to let users upload sourcecode
and then compile it using my cygwin gcc... But one thing at a time... I
can't get that gcc to execute...

shell_exec("gcc temp.c"); # Doesn't work as that will use MinGW
shell_exec("D:\\cygwin\\bin\\gcc.exe temp.c"); /* Gives some error about dll
stuff (procedure not found I think)*/

So my next though was to open "bash.exe --login -I" and fwrite the
commands... But that still tries to use the mingw compiler it seems...Guess
there's some environiment problem... So I figured I could use virtual() to a
cgi script with this as first line:
#!D:/cygwin/bin/perl
and then use the perl open(), with |/cygdrive/d/bin/gcc.exe temp.c as
argument... Seems like it executes the right compiler then, but then I get
millions of errors caused by *.h can't be opened (yes, the source tries to
include them), so I though about passing -B /usr/include to it... But those
errors still appear... Also, it feels somewhat bad to use virtual() to call
perl scripts, so I was wondering if you ppl have some nice idea on how I
would do it?

Paths:
Cygwin: d:\cygwin
PHP: C:\PHP (4.3.3, zip from php.net, installed as Apache 1.3.28 module)
Apache: D:\Apache (installed using .msi package, as service)
Perl: D:\perl\bin\perl.exe (or D:\cygwin\bin\perl.exe)
Script: D:\www2\compile.php, D:\www2\compiling\compile_cyg.cgi
Sourcecode: D:\www2\compiling\temp.c (yes, only one file yet, that's a later
problem)

pwd returns I'm in the 'compiling' folder, in the php script, I chdir() to
get into that folder...

Can anyone help, please? Security is not a concern, it's private, and it's
for learning purposes mostly... I use winXP home... I can install stuff like
I want, that's not a problem... Thanks in advance!


-- 
// DvDmanDT
MSN: dvdmandt@hotmail.com
Mail: dvdmandt@telia.com

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux