1

My goal: Writing some C#-code, compile it, and run it at the target server (Apache Web Server, OS: Debian GNU/Linux 32bit) using PHP-command passthru("newfile",...).

Now: Based on the advice I got here I did compile my C#-code with Mono and did create a 32bit Linux-executable file (on my Ubuntu 11.10 32bit system) using

mkbundle -o newfile oldfile.exe --static

However, when calling this newfile via PHP it doesn't give the expected return value "Hello World", but the number 1.

Questions: Am I using mkbundle wrongly? How can I find out where the problem lies?

Additional info: Writing file newfile on the target system gives

newfile: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped

My C#-code is a simple Hello-World program printing Hello World into the console. The PhP command I use is <?php passthru("./newfile", $temp); echo "$temp"; ?> The return value I get from this PhP-file is simply 1. The Apache log files show no error.

Community
  • 1
  • 1
tyrex
  • 8,208
  • 12
  • 43
  • 50
  • How do you call it in PHP, and did you make it a console application that prints to Console? Please post calling PHP code and some C# if possible. Thanks – drew010 Feb 12 '12 at 05:12
  • I use the PHP commands `passthru("./newfile", $temp); echo "$temp";`. And yes, it is a console application which prints to Console the words `Hello World`. I included this info in my post which was a pain because of alleged formatting mistakes. – tyrex Feb 12 '12 at 05:35
  • If you try and run your newfile program on the source system, does it work? – IanNorton Feb 12 '12 at 07:51
  • Sorry for the late reply. Yes it does work perfectly. – tyrex Feb 12 '12 at 21:45
  • You should also use the --deps option in mkbundle. Static only links the mono runtime, you need the assemblies as well. – konrad.kruczynski Feb 21 '12 at 21:45

0 Answers0