title: Apache RewriteMap prg using fopen('php://stdin', 'r') not working over HTTPS
body: <p>I've set up a RewriteMap using <code>prg</code> which calls a php script, like this:</p>
  <pre><code> #!/usr/local/bin/php
  &lt;?php
  
  /* DB query generates $map */
  
  $stdout = fopen('php://stdout', 'w');
  $stdin  = fopen('php://stdin', 'r');
              
  stream_set_write_buffer($stdout, 0);
              
  while(!feof($stdin)):
                  
      $input  = fgets($stdin);
              
      fputs($stdout, (array_key_exists($input,$map) ? $map[$input] : 'NULL') . &quot;\n&quot;);
                  
  endwhile;
  ?&gt;
  </code></pre>
  <p>And then .htaccess puts the output in an env variable MAPTO like this:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
    RewriteRule ^ - [E=MAPTO:${mymap:%1}]
    RewriteCond %{ENV:MAPTO} !=&quot;&quot;
    RewriteRule ^.*$ http://myproxiedcontent.com/%{ENV:MAPTO}/$0 [P,NC]
  &lt;/IfModule&gt;
  </code></pre>
  <p>It works correctly over HTTP, but over HTTPS no input is returned.</p>
  <p>I'm using Apache 2.4, PHP 7.2 and have confirmed that OpenSSL is installed.</p>
  <p>What could be going on here?</p>