# Linux PHP Executable Output Issue with IE

**URL:** <https://community.unix.com/t/linux-php-executable-output-issue-with-ie/252180>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [October 27, 2009, 10:21am UTC](https://community.unix.com/t/linux-php-executable-output-issue-with-ie/252180 "2009-10-27T10:21:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dleblanc67](https://community.unix.com/letter_avatar/dleblanc67/32/6_449c533f586939b6e5f246632a46421f.png) [@dleblanc67](https://community.unix.com/u/dleblanc67)\
**Post date:** [October 27, 2009, 10:21am UTC](https://community.unix.com/t/linux-php-executable-output-issue-with-ie/252180/1 "2009-10-27T10:21:41Z")

</div>

I have developed a PHP web page that executes a batch file and pipes the output to a file. It works fine when using Firefox, Safari, etc. However, when using IE, it does not work.

$execute = `batch.bat $var1 $var2 | tee /batch.output`;  
print "\<pre\>$execute\</pre\>";

When the page is run in IE, the batch file is run correctly, the variables are passed to the executable. Even the output is correct on the screen (verified using the \<pre\>tags). However, the file batch.output is not created when run with IE (but is with other browsers).

Suggestions?

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_449c533f586939b6e5f246632a46421f.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [October 27, 2009, 6:00pm UTC](https://community.unix.com/t/linux-php-executable-output-issue-with-ie/252180/2 "2009-10-27T18:00:39Z")

</div>

Is that really a .bat file? What kind of server is this?

Your PHP script as is prints "correct" output even when the file isn't written. If tee fails to open batch.output for some reason, it will print an error message to standard error(which you will NOT see on your web browser) and continue to write to other outputs. I'd leave out the tee and read back from the file with PHP. That'll save you an extra process, too.

```nohighlight
<?php
$lastline=system("batch.bat $var1 $var2 2>&1 > /batch.output", $retval);
if($reval != 0)
  die "Command failed: Error code $retval, '$lastline'";

$fp=fopen("/batch.output", "r");
echo "<pre>";
fpassthru($fp);
echo "</pre>";
fclose(fp); ?>

```

That should redirect stderr to stdout where $lastline can pick it up, and the file to /batch.output

I have no idea why the file isn't created for IE, but getting an actual error message always helps.
