April 25, 2012
How do I deal with this (on OSX); are CGI programs not allowed to
write to files? How to change this?

Thanks, NMS

test.d:
#!/usr/local/bin/rdmd

import std.stdio;

void main() {
       writeln("Content-type: text/plain\r\n\r\nHello, World!");
}

error log:
[Wed Apr 25 00:03:01 2012] [error] [client ::1] sh:
/Users/nathanmswan/Sites/test.d.deps: Permission denied
[Wed Apr 25 00:03:01 2012] [error] [client ::1] Failed: dmd  -v
-o- '/Users/nathanmswan/Sites/test.d'
-I'/Users/nathanmswan/Sites' >/Users/nathanmswan/Sites/test.d.deps
[Wed Apr 25 00:03:01 2012] [error] [client ::1] Premature end of
script headers: test.d

April 25, 2012
On Wednesday, 25 April 2012 at 18:11:16 UTC, Nathan M. Swan wrote:
> How do I deal with this (on OSX); are CGI programs not allowed to
> write to files? How to change this?
>
> Thanks, NMS
>
> test.d:
> #!/usr/local/bin/rdmd
>
> import std.stdio;
>
> void main() {
>        writeln("Content-type: text/plain\r\n\r\nHello, World!");
> }
>
> error log:
> [Wed Apr 25 00:03:01 2012] [error] [client ::1] sh:
> /Users/nathanmswan/Sites/test.d.deps: Permission denied
> [Wed Apr 25 00:03:01 2012] [error] [client ::1] Failed: dmd  -v
> -o- '/Users/nathanmswan/Sites/test.d'
> -I'/Users/nathanmswan/Sites'
> >/Users/nathanmswan/Sites/test.d.deps
> [Wed Apr 25 00:03:01 2012] [error] [client ::1] Premature end of
> script headers: test.d

Have you checked that your web server has write access to /Users/nathanmswan/Sites/ ?


April 26, 2012
> Have you checked that your web server has write access to /Users/nathanmswan/Sites/ ?

Yes, it works now, thanks!
NMS

P.S. Sorry this might be in the wrong forum, but now I can advertise my homepage as "index.d" instead of compiling it and having it be "index.cgi"
April 26, 2012
Am Thu, 26 Apr 2012 05:44:59 +0200
schrieb "Nathan M. Swan" <nathanmswan@gmail.com>:

> > Have you checked that your web server has write access to /Users/nathanmswan/Sites/ ?
> 
> Yes, it works now, thanks!
> NMS
> 
> P.S. Sorry this might be in the wrong forum, but now I can advertise my homepage as "index.d" instead of compiling it and having it be "index.cgi"

D is not a virtual machine language. You have to compile your code to execute it. (In case that was unclear.)
As for the extension, that is probably a configuration option of your web server. Search for CGI extensions or .cgi and add .d there.

-- 
Marco

April 26, 2012
On 26/04/12 15:52, Marco Leise wrote:
> Am Thu, 26 Apr 2012 05:44:59 +0200
> schrieb "Nathan M. Swan"<nathanmswan@gmail.com>:
>
>>> Have you checked that your web server has write access to
>>> /Users/nathanmswan/Sites/ ?
>>
>> Yes, it works now, thanks!
>> NMS
>>
>> P.S. Sorry this might be in the wrong forum, but now I can
>> advertise my homepage as "index.d" instead of compiling it and
>> having it be "index.cgi"
>
> D is not a virtual machine language. You have to compile your code to execute it. (In case that was unclear.)

... don't see why you shouldn't use rdmd.

> As for the extension, that is probably a configuration option of your web server. Search for CGI extensions or .cgi and add .d there.

Isn't it considered bad practice in modern web design to have _any_ file extension visible?  Or at least any file extension that hints at the underlying software.

If nothing else, it's bad for future-proofing of URLs.  What happens when you switch your site from D to D++ in the year 2025? :-)
April 26, 2012
Am Thu, 26 Apr 2012 16:12:05 +0200
schrieb Joseph Rushton Wakeling <joseph.wakeling@webdrake.net>:

> > D is not a virtual machine language. You have to compile your code to execute it. (In case that was unclear.)
> 
> ... don't see why you shouldn't use rdmd.

Yes, rdmd is one of the tools that compile your code. It's just not like you call up a .php and it executes in a virtual machine _instead_ of _compiling_ and executing native code.

-- 
Marco

April 26, 2012
On Thursday, 26 April 2012 at 03:45:01 UTC, Nathan M. Swan wrote:
> P.S. Sorry this might be in the wrong forum, but now I can advertise my homepage as "index.d" instead of compiling it and having it be "index.cgi"

On Apache, you can do something like this in your
.htaccess:

Options +ExecCGI

<Files "app">
        SetHandler cgi-script
</Files>

April 26, 2012
On Thu, Apr 26, 2012 at 04:12:05PM +0200, Joseph Rushton Wakeling wrote:
> On 26/04/12 15:52, Marco Leise wrote:
[...]
> >As for the extension, that is probably a configuration option of your web server. Search for CGI extensions or .cgi and add .d there.
> 
> Isn't it considered bad practice in modern web design to have _any_ file extension visible?  Or at least any file extension that hints at the underlying software.
> 
> If nothing else, it's bad for future-proofing of URLs.  What happens when you switch your site from D to D++ in the year 2025? :-)

File extensions in URLs are a thing of the 90's. Nowadays webserver technology makes it possible (and desirable) to drop them altogether. That way, you can implement the initial version of your page as page.pl, then later change it to page.php when you upgrade, and yet later change it to page.d, all without affecting your users or links to that page in the least. If you use something similar to Apache's autoindex, you can even replace it with page/index.d when you decide that the page needs some separate subpages, WITHOUT needing to edit URLs all over the place.

(Besides, URL means "*Universal* resource locater": it's not supposed to
change without good reason!)


T

-- 
A linguistics professor was lecturing to his class one day. "In English," he said, "A double negative forms a positive. In some languages, though, such as Russian, a double negative is still a negative. However, there is no language wherein a double positive can form a negative." A voice from the back of the room piped up, "Yeah, yeah."
Top | Discussion index | About this forum | D home