Compile C # as CGI

How do you compile a C # program as CGI to run the LAMP / Linux / Apache server in the cgi-bin?

+3
source share
3 answers

Perhaps you could use a very simple shell script, for example, using bash, which itself runs your C # program with mono in normal mode. eg:.

#!/usr/bin bash

/usr/bin/opt/mono myprogram.exe $@

(Of course, just using Apache with mod_mono is a much better solution if you can.)

+1
source

Nothing special is required - just compile the application as usual with the Mono gmcs compiler.

For more information about integration, see the following two links:

http://www.mono-project.com/ASP.NET

CGI:

http://www.mono-project.com/CGI

+1

C, , gnu. , ,

gcc -o <name_of_output_file>.cgi <name_of_source_file>

Regardless of what you call the file, you need to provide the .cgi extension  All you need to do is move it to the cgi-bin folder, remember to set permissions for the program, usually for cgi files that you use 755;

chmod 755 <name_of_file>

This is how I do it for C, C # I think this is the same thing.

+1
source

Source: https://habr.com/ru/post/1748296/


All Articles