tags:

views:

88

answers:

2

Hi,

I call a file with popen():

$fp = @popen("/usr/bin/openssl ...");

the specific details don't matter, but what happens here is that when I run the command I receive these errors on a Windows CMD:

The system cannot find message text for message number 0x3 in the message file for System.

I know that the file don't exist on Windows, but why doesn't @ silence the errors? My library just tries a few different ways to achieve the same thing.

+2  A: 

This is not a error message issued by PHP, so PHP's error suppression won't apply.

You'll have to check whether you can run the operation beforehand or suppress the output of system errors.

For suppressing, 2>NUL should work, as you say. Wouldn't it be better though to test whether the file exists at all? On a Windows machine, your executable is most probably not located in /usr/bin/openssl.

if (file_exists("/usr/bin/...."))
 popen(".....");
Pekka
How could I suppress the output of system errors? Editing my Windows settings?
rFactor
See my edited answer.
Pekka
+1  A: 

Here's the answer I found:

I just wrote " 2>NUL" in the end of the CMD call to make all Windows errors to disappear.

rFactor