How to setup D language with Apache httpd cgi?

BoQsc vaidas.boqsc at gmail.com
Wed Jul 31 12:55:16 UTC 2019


Hmm, it seems that once I remove sudo from the shebang, the error 
disappears and Internal Server Error disappears.

example.d - does not work
>#!/usr/bin/env -S sudo dub /+ dub.sdl:
>	name "hello"
>	
>	
>+/
>import std.stdio;
>void main()
>{
>    writeln(`Content-type: text/html`);
>    writeln(``);
>    writeln(`<body style="background: lightgreen">CGI D 
> Example</body>`);
>
>}


/var/log/apache2/error.log

>[Wed Jul 31 15:48:07.769766 2019] [cgid:error] [pid 4012:tid 
>140324198397696] [client >127.0.0.1:51736] End of script output 
>before headers: example.d


example.d - Works perfectly, no errors in the log
>#!/usr/bin/env -S dub /+ dub.sdl:
>	name "hello"
>	
>	
>+/
>import std.stdio;
>void main()
>{
>    writeln(`Content-type: text/html`);
>    writeln(``);
>    writeln(`<body style="background: lightgreen">CGI D 
> Example</body>`);
>
>}


More information about the Digitalmars-d-learn mailing list