|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[1998-06-29 10:26 UTC] khapeman at skidmore dot edu
<H1>File Error Message Test</H1> <? $cmd = "ls dir/transactions1/junk.170_*"; $tst = @exec($cmd); ?> This produces the following message before the heading is displayed: dir/transactions1/junk.170_*: No such file or directory PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
ls writes to stderr, which isn't piped by popen(), which results in this behavior. There's nothing you can do about it at the PHP level. You can, however, ask the shell to do the job for you, by doing something like: $tst = @exec("ls dir/transactions1/junk.170_* 2> /dev/null"); which tells sh to redirect all stderr output to /dev/null.