Permalink
Browse files

mod_php doesn't set proper environment variables, apparently. this fi…

…xes that.
  • Loading branch information...
1 parent a3b7101 commit 1254fbb3a0c71751880cc190f2a439122716b2d0 @emmausrs committed Jan 16, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 cgi_wrapper.php
View
@@ -28,6 +28,11 @@ function escapequotes(&$string) {
function execute_cgi($script)
{
+ // Set the proper environment variables if they aren't present.
+ if (!isset($_ENV['REQUEST_METHOD']))
+ foreach ($_SERVER as $var => $value)
+ putenv("$var=$value"); // not sure if safe
+
$ph = proc_open($script, array(
array('pipe', 'r'), // STDIN
array('pipe', 'w'), // STDOUT

0 comments on commit 1254fbb

Please sign in to comment.