On Wednesday, 31 July 2019 at 07:42:22 UTC, BoQsc wrote:
This seems to work well when running not from cgi, so there is
That was not true, it didn't work even from Linux Shell, I
corrected shebang, now it works from Linux Shell.
An, unexpected thing: It did require permissions: sudo
./example.d which was not the case with rdmd.
cgi still shows Internal Server Error.
Maybe cgi cannot run this script due to lacking sudo
permissions required by dub? Unsure.
#!/usr/bin/env -S dub run --single
/+ dub.sdl:
name "hello"
dependency "arsd-official" version="~>4.0.1"
+/
import std.stdio;
void main()
{
writeln(`Content-type: text/html`);
writeln(``);
writeln(`<body style="background: lightgreen">CGI D
Example</body>`);
}
It seems that /var/log/apache2/error.log shows Permission denied
error.
[Wed Jul 31 10:44:26.887024 2019] [cgid:error] [pid 846:tid
140090256426752] [client >127.0.0.1:57052] malformed header from
script 'example.d': Bad header: Fetching arsd-official 4.0.1 (
/usr/lib/cgi-bin/.dub/packages/: Permission denied