I have a SSCCE, DebugR.cgi:

#!c:/Strawberry/Perl/bin/perl use strict; use warnings; use Statistics::R; use CGI qw(:standard escapeHTML -utf8); print header(-type=>'text/html', -charset=>'utf-8'); my $R = Statistics::R->new(); print "R created\n"; $R->run('options(scipen = 999)'); # disabling scientific notation i +n R. print "R initialised\n";

Running this from the command line works as expected:

C:\Information\mgroot\cgi-bin>perl DebugR.cgi Content-Type: text/html; charset=utf-8 R created R initialised

But pointing a browser to it via an Apache web server results in only the "R created" line and the following errors in the log:

[Wed Jan 29 13:58:44 2020] [error] [client 192.168.1.207] ack Invalid +argument: write( 5, 'cmd<-c("write(ngettext(1, \\"Error: \\", \\"\\", + domain=\\"R\\"), stdout())"); write("\\1",stdout()) [Wed Jan 29 13:58:44 2020] [error] [client 192.168.1.207] ' ) at C:/St +rawberry/perl/vendor/lib/IPC/Run/IO.pm line 549. [Wed Jan 29 13:58:44 2020] [error] [client 192.168.1.207] Warning: una +ble to close filehandle GEN10 properly: Bad file descriptor during gl +obal destruction. [Wed Jan 29 13:58:44 2020] [error] [client 192.168.1.207] Warning: una +ble to close filehandle GEN5 properly: Bad file descriptor during glo +bal destruction.

It is not obvious to me why there should be a difference or where to start looking next. Any clues would be appreciated.

Regards,

John Davies


In reply to Apache causing R to crash by davies

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.